wtext.h File Reference

#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <WindowsX.h>
#include "wresource.h"
#include "resource.h"
#include "wcommon.h"
#include "version.h"

Include dependency graph for wtext.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define CTRLA   1
#define CTRLB   2
#define CTRLC   3
#define CTRLD   4
#define CTRLE   5
#define CTRLF   6
#define CTRLH   8
#define CTRLK   11
#define CTRLL   12
#define CTRLN   14
#define CTRLP   16
#define CTRLU   21
#define CTRLW   23
#define KeyBufferSize   256
#define MAXSTR   256
#define NOTEXT   0xF0

Functions

EXPORT void WINAPI TextMessage (void)
EXPORT int WINAPI TextInit (LPTW lptw)
EXPORT void WINAPI TextClose (LPTW lptw)
EXPORT void WINAPI TextToCursor (LPTW lptw)
EXPORT int WINAPI TextPutCh (LPTW lptw, BYTE ch)
EXPORT int WINAPI TextKBHit (LPTW lptw)
EXPORT int WINAPI TextGetCh (LPTW lptw)
EXPORT int WINAPI TextGetChE (LPTW lptw)
EXPORT LPSTR WINAPI TextGetS (LPTW lptw, LPSTR str, unsigned int size)
EXPORT int WINAPI TextPutS (LPTW lptw, LPSTR str)
EXPORT void WINAPI TextGotoXY (LPTW lptw, int x, int y)
EXPORT int WINAPI TextWhereX (LPTW lptw)
EXPORT int WINAPI TextWhereY (LPTW lptw)
EXPORT void WINAPI TextCursorHeight (LPTW lptw, int height)
EXPORT void WINAPI TextClearEOL (LPTW lptw)
EXPORT void WINAPI TextClearEOS (LPTW lptw)
EXPORT void WINAPI TextInsertLine (LPTW lptw)
EXPORT void WINAPI TextDeleteLine (LPTW lptw)
EXPORT void WINAPI TextScrollReverse (LPTW lptw)
void NewLine (LPTW lptw)
void UpdateText (LPTW lptw, int count)
void TextPutStr (LPTW lptw, LPSTR str)
void ReadRegistryTxt (LPTW lptw)
void LimitMark (LPTW lptw, POINT FAR *lppt)
void ClearMark (LPTW lptw, POINT pt)
void DoLine (LPTW lptw, HDC hdc, int xpos, int ypos, int offset, int count)
void DoMark (LPTW lptw, POINT pt, POINT end, BOOL mark)
void UpdateMark (LPTW lptw, POINT pt)
void TextCopyClip (LPTW lptw)
void TextMakeFont (LPTW lptw)
void TextSelectFont (LPTW lptw)
int CtrlCHit (LPTW lptw)
void ResizeScreenBuffer (LPTW lptw)
void ReAllocScreenBuffer (LPTW lptw)
void InitScreenBuffer (LPTW lptw)
void ReorganizeScreenBuffer (LPTW lptw)
void ClearCommandWindow (LPTW lptw, BOOL Clearfirstline)
void ClearLinesScreenConsole (int NbrOfLines)
void CleanClipboard (LPTW lptw)
void SelectAll (LPTW lptw, BOOL DoAMark)
void UnSelect (LPTW lptw)
void HelpOn (LPTW lptw)
void OpenSelection (LPTW lptw)
void CutSelection (LPTW lptw)
void EvaluateSelection (LPTW lptw)
void OnRightClickMenu (LPTW lptw)
void InvalidateCursor (void)
BOOL HasAZoneTextSelected (LPTW lptw)
DWORD WINAPI SendInputText (LPVOID lpParam)
void CleanPromptFromText (char *Text)
int ReplacePrompt (char *Text, char *prompt)
void ForceToActiveWindowParent (void)
void PrintSelectionGUI (LPTW lptw, char *Entete)
void ExitWindow (void)
void write_scilab_synchro (char *line)
DWORD WINAPI WriteTextThread (LPVOID lpParam)
BOOL WriteIntoScilab (LPTW lptw, char *StringCommand)
void WriteIntoKeyBuffer (LPTW lptw, char *StringCommand)
BOOL IsToThePrompt (void)
void EnableNMenus (LPTW lptw, int numbermenus)
void EnableMenus (LPTW lptw)
void DisableMenus (LPTW lptw)
void EnableToolBar (LPTW lptw)
void DisableToolBar (LPTW lptw)
int GetCurrentLanguage (void)

Variables

BOOL ConsoleIsMinimized


Define Documentation

#define CTRLA   1

Definition at line 48 of file wtext.h.

Referenced by SendMacro().

#define CTRLB   2

Definition at line 49 of file wtext.h.

Referenced by SendMacro().

#define CTRLC   3

Definition at line 50 of file wtext.h.

#define CTRLD   4

Definition at line 51 of file wtext.h.

Referenced by SendMacro().

#define CTRLE   5

Definition at line 52 of file wtext.h.

Referenced by SendMacro(), and TextGetCh().

#define CTRLF   6

Definition at line 53 of file wtext.h.

Referenced by SendMacro().

#define CTRLH   8

Definition at line 54 of file wtext.h.

Referenced by SendMacro().

#define CTRLK   11

Definition at line 55 of file wtext.h.

Referenced by SendMacro().

#define CTRLL   12

Definition at line 56 of file wtext.h.

Referenced by OpenSelection(), and SendMacro().

#define CTRLN   14

Definition at line 57 of file wtext.h.

#define CTRLP   16

Definition at line 58 of file wtext.h.

Referenced by SendMacro().

#define CTRLU   21

Definition at line 59 of file wtext.h.

Referenced by Callback_ABORT(), Callback_CHDIR(), Callback_CONFIGUREBROWSER(), Callback_DEMOS(), Callback_EXEC(), Callback_GETCWD(), Callback_GETF(), Callback_HELP(), Callback_LOAD(), Callback_OPEN(), Callback_PAUSE(), Callback_RESTART(), Callback_RESUME(), Callback_SAVE(), Callback_SCIPAD(), ClearCommandWindow(), ON_WND_CONSOLE_WM_EXITSIZEMOVE(), SendMacro(), SetLanguageMenu(), and zzledt().

#define CTRLW   23

Definition at line 60 of file wtext.h.

Referenced by SendMacro().

#define KeyBufferSize   256

Definition at line 65 of file wtext.h.

Referenced by TextInit().

#define MAXSTR   256

Definition at line 70 of file wtext.h.

#define NOTEXT   0xF0

Definition at line 72 of file wtext.h.


Function Documentation

void CleanClipboard ( LPTW  lptw  ) 

Definition at line 276 of file clipboard.c.

References FALSE, hThreadPaste, tagTW::hWndParent, and ThreadPasteRunning.

Referenced by Callback_EMPTYCLIPBOARD().

00277 {
00278         if (ThreadPasteRunning)
00279         {
00280                 SuspendThread(hThreadPaste);
00281                 TerminateThread(hThreadPaste,1);
00282         ThreadPasteRunning=FALSE;
00283         CloseHandle( hThreadPaste );
00284         }
00285 
00286         OpenClipboard(lptw->hWndParent);
00287         EmptyClipboard();
00288         CloseClipboard();
00289 }

Here is the caller graph for this function:

void CleanPromptFromText ( char *  Text  ) 

Definition at line 1516 of file wtext.c.

References FREE, i, MALLOC, NULL, prompt, ReplacePrompt(), SCIPROMPT, SCIPROMPT_INTERRUPT, and SCIPROMPT_PAUSE.

01517 {
01518         char *CleanText=NULL;
01519         
01520         char prompt[6];
01521 
01522         int LenText=0;
01523         int i=0;
01524         
01525         LenText=strlen(Text)+1;
01526         CleanText=(char*)MALLOC(LenText*sizeof(char));
01527         strcpy(CleanText,Text);
01528         
01529         strcpy(prompt,SCIPROMPT);
01530         ReplacePrompt(CleanText,prompt);
01531         
01532         strcpy(prompt,SCIPROMPT_PAUSE);
01533         ReplacePrompt(CleanText,prompt);
01534         
01535 
01536         for (i=1;i<127;i++)
01537         {
01538                 char TmpPrompt[6];
01539                 wsprintf(TmpPrompt,SCIPROMPT_INTERRUPT,i);
01540                 ReplacePrompt(CleanText,TmpPrompt);
01541                 strcpy(TmpPrompt," ");
01542         }
01543         
01544         strcpy(Text,CleanText);
01545         
01546         FREE(CleanText);
01547 }

Here is the call graph for this function:

void ClearCommandWindow ( LPTW  lptw,
BOOL  Clearfirstline 
)

Definition at line 1416 of file wtext.c.

References tagTW::CharSize, ClearMark(), CTRLU, FALSE, HasAZoneTextSelected(), tagTW::hWndText, InitScreenBuffer(), tagTW::Marking, NULL, pt, SB_HORZ, SB_VERT, tagTW::ScreenBuffer, tagTW::ScreenSize, tagTW::ScrollPos, SendCTRLandAKey(), TextGotoXY(), and TRUE.

01417 {
01418         /* Deselectionne une eventuelle zone de texte */
01419         if ( HasAZoneTextSelected(lptw) )
01420         {
01421                 POINT pt;
01422                 pt.x = 0;
01423                 pt.y = 0;
01424                 pt.x = (pt.x + lptw->ScrollPos.x)/lptw->CharSize.x;
01425                 pt.y = (pt.y + lptw->ScrollPos.y)/lptw->CharSize.y;
01426                 ClearMark(lptw, pt);
01427                 lptw->Marking = FALSE;
01428         }
01429         if (Clearfirstline) SendCTRLandAKey(CTRLU); /*On efface la ligne courante */
01430         InitScreenBuffer(lptw);
01431         
01432         /* Initialisation su buffer Ecran */
01433         _fmemset (lptw->ScreenBuffer, ' ', lptw->ScreenSize.x * lptw->ScreenSize.y);
01434         
01435         /* Repositionnement de la ligne de commande */
01436         TextGotoXY (lptw, 0, 0);
01437         /* Remise à zero des scrollbars */
01438         lptw->ScrollPos.x=0;
01439         lptw->ScrollPos.y=0;
01440         SetScrollPos (lptw->hWndText, SB_VERT, lptw->ScrollPos.y, TRUE);
01441         SetScrollPos (lptw->hWndText, SB_HORZ, lptw->ScrollPos.x, TRUE);
01442         /* Reactualisation de la fenetre */
01443         UpdateWindow (lptw->hWndText);
01444         InvalidateRect (lptw->hWndText, NULL, TRUE);
01445 }

Here is the call graph for this function:

void ClearLinesScreenConsole ( int  NbrOfLines  ) 

Definition at line 1388 of file wtext.c.

References tagTW::AttrBuffer, tagTW::CursorPos, GetTextWinScilab(), tagTW::hWndText, i, IsWindowInterface(), MSG_WARNING28, NOTEXT, NULL, sciprint(), tagTW::ScreenBuffer, tagTW::ScreenSize, TextGotoXY(), TRUE, and X.

Referenced by sci_clc().

01389 {
01390         if (IsWindowInterface())
01391         {
01392                 int X=0,Y=0;
01393                 int i = 0;
01394                 LPTW lptw=GetTextWinScilab();
01395 
01396                 X=lptw->CursorPos.x;
01397                 Y=lptw->CursorPos.y-NbrOfLines;
01398                 if (Y>0)
01399                 {
01400                         i=(Y)*lptw->ScreenSize.x;
01401 
01402                         _fmemset(lptw->ScreenBuffer + i, ' ', (NbrOfLines+1)*lptw->ScreenSize.x);
01403                         _fmemset(lptw->AttrBuffer + i, NOTEXT, (NbrOfLines+1)*lptw->ScreenSize.x);
01404 
01405                         TextGotoXY (lptw, X,Y);
01406                         InvalidateRect (lptw->hWndText, NULL, TRUE);
01407                 }
01408                 else
01409                 {
01410                         sciprint(MSG_WARNING28);
01411                 }
01412         }
01413 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ClearMark ( LPTW  lptw,
POINT  pt 
)

Definition at line 524 of file wtext.c.

References tagTW::CharSize, tagTW::hWndText, LimitMark(), tagTW::MarkBegin, tagTW::MarkEnd, tagTW::ScreenSize, tagTW::ScrollPos, and TRUE.

00525 {
00526   RECT rect1, rect2, rect3;
00527   int tmp;
00528   if ((lptw->MarkBegin.x != lptw->MarkEnd.x) ||
00529       (lptw->MarkBegin.y != lptw->MarkEnd.y))
00530     {
00531       if (lptw->MarkBegin.x > lptw->MarkEnd.x)
00532         {
00533           tmp = lptw->MarkBegin.x;
00534           lptw->MarkBegin.x = lptw->MarkEnd.x;
00535           lptw->MarkEnd.x = tmp;
00536         }
00537       if (lptw->MarkBegin.y > lptw->MarkEnd.y)
00538         {
00539           tmp = lptw->MarkBegin.y;
00540           lptw->MarkBegin.y = lptw->MarkEnd.y;
00541           lptw->MarkEnd.y = tmp;
00542         }
00543       /* calculate bounding rectangle in character coordinates */
00544       if (lptw->MarkBegin.y != lptw->MarkEnd.y)
00545         {
00546           rect1.left = 0;
00547           rect1.right = lptw->ScreenSize.x;
00548         }
00549       else
00550         {
00551           rect1.left = lptw->MarkBegin.x;
00552           rect1.right = lptw->MarkEnd.x + 1;
00553         }
00554       rect1.top = lptw->MarkBegin.y;
00555       rect1.bottom = lptw->MarkEnd.y + 1;
00556       /* now convert to client coordinates */
00557       rect1.left = rect1.left * lptw->CharSize.x - lptw->ScrollPos.x;
00558       rect1.right = rect1.right * lptw->CharSize.x - lptw->ScrollPos.x;
00559       rect1.top = rect1.top * lptw->CharSize.y - lptw->ScrollPos.y;
00560       rect1.bottom = rect1.bottom * lptw->CharSize.y - lptw->ScrollPos.y;
00561       /* get client rect and calculate intersection */
00562       GetClientRect (lptw->hWndText, &rect2);
00563       IntersectRect (&rect3, &rect1, &rect2);
00564       /* update window if necessary */
00565       if (!IsRectEmpty (&rect3))
00566         {
00567           InvalidateRect (lptw->hWndText, &rect3, TRUE);
00568         }
00569     }
00570   LimitMark (lptw, &pt);
00571   lptw->MarkBegin.x = lptw->MarkEnd.x = pt.x;
00572   lptw->MarkBegin.y = lptw->MarkEnd.y = pt.y;
00573   UpdateWindow (lptw->hWndText);
00574 }

Here is the call graph for this function:

int CtrlCHit ( LPTW  lptw  ) 

Definition at line 867 of file wtext.c.

References HasAZoneTextSelected(), SignalCtrC(), TextCopyClip(), and TextKBHit().

00868 {
00869   int ch;
00870   
00871   if (TextKBHit (lptw))
00872     {
00873       ch = *lptw->KeyBufOut++;
00874       if (lptw->KeyBufOut - lptw->KeyBuf >= (int) lptw->KeyBufSize)
00875         lptw->KeyBufOut = lptw->KeyBuf;         /* wrap around */
00876       if (ch == 3)
00877         {
00878         
00879           if ( HasAZoneTextSelected(lptw) )
00880           {
00881                 TextCopyClip(lptw);
00882           }
00883           else
00884           {
00885                 SignalCtrC ();
00886           }
00887           
00888           
00889           return (1);
00890         }
00891     }
00892   return (0);
00893 }

Here is the call graph for this function:

void CutSelection ( LPTW  lptw  ) 

Definition at line 1156 of file wtext.c.

01157 {
01158 }

void DisableMenus ( LPTW  lptw  ) 

Definition at line 2001 of file wtext.c.

References tagMW::hMenu, tagTW::hWndParent, i, and tagTW::lpmw.

Referenced by TextInit().

02002 {
02003   int i=0;
02004   int Nums = GetMenuItemCount (lptw->lpmw->hMenu);
02005 
02006   for(i=0;i<Nums;i++)
02007   {
02008           EnableMenuItem (lptw->lpmw->hMenu, i, MF_GRAYED| MF_BYPOSITION);
02009   }
02010   DrawMenuBar(lptw->hWndParent); 
02011 }

Here is the caller graph for this function:

void DisableToolBar ( LPTW  lptw  ) 

Definition at line 343 of file Toolbar.c.

References tagMW::hButton, i, tagTW::lpmw, tagMW::nButton, and tagMW::ShowToolBar.

Referenced by TextInit().

00344 {
00345         int i=0;
00346         if (lptw->lpmw->ShowToolBar)
00347         {
00348                 for (i = 0; i < lptw->lpmw->nButton; i++)
00349                 {
00350                         ShowWindow( lptw->lpmw->hButton[i] , SW_HIDE );
00351                 }
00352         }
00353 }

Here is the caller graph for this function:

void DoLine ( LPTW  lptw,
HDC  hdc,
int  xpos,
int  ypos,
int  offset,
int  count 
)

Definition at line 577 of file wtext.c.

References tagTW::AttrBuffer, tagTW::CharSize, GetIhmTextBackgroundColor(), GetIhmTextColor(), MSG_ERROR56, NULL, num, tagTW::ScreenBuffer, and tagTW::ScreenSize.

00578 {
00579         BYTE FAR *pa, attr;
00580         int idx, num;
00581         pa = lptw->AttrBuffer + offset;
00582         if ((offset < 0) || (offset >= lptw->ScreenSize.x*lptw->ScreenSize.y))
00583         MessageBox((HWND)NULL, MSG_ERROR56, MSG_ERROR56, MB_OK | MB_ICONEXCLAMATION);
00584         idx = 0;
00585         num = count;
00586         while (num > 0)
00587         {
00588                 attr = *pa;
00589                 while ((num > 0) && (attr == *pa))
00590                 {
00591                         /* skip over bytes with same attribute */
00592                         num--;
00593                         pa++;
00594                 }
00595 
00596                 SetTextColor(hdc, GetIhmTextColor());
00597                 SetBkColor(hdc, GetIhmTextBackgroundColor());
00598         
00599                 TextOut(hdc,xpos,ypos, (LPSTR)(lptw->ScreenBuffer + offset + idx),
00600                         count-num-idx);
00601                 xpos += lptw->CharSize.x * (count-num-idx);
00602                 idx = count-num;
00603         }
00604 }

Here is the call graph for this function:

void DoMark ( LPTW  lptw,
POINT  pt,
POINT  end,
BOOL  mark 
)

Definition at line 606 of file wtext.c.

References tagTW::CharSize, count, DoLine(), hdc, tagTW::hfont, tagTW::hWndText, offset, tagTW::ScreenBuffer, tagTW::ScreenSize, tagTW::ScrollPos, and void().

Referenced by SelectAll(), and UpdateMark().

00607 {
00608   int xpos, ypos;
00609   HDC hdc;
00610   int count;
00611   int offset;
00612   offset = lptw->ScreenSize.x * pt.y + pt.x;
00613   hdc = GetDC (lptw->hWndText);
00614   SelectFont (hdc, lptw->hfont);
00615 
00616   SetTextColor (hdc, GetSysColor (COLOR_HIGHLIGHTTEXT));
00617   SetBkColor (hdc, GetSysColor (COLOR_HIGHLIGHT));
00618 
00619   while (pt.y < end.y)
00620     {
00621       /* multiple lines */
00622       xpos = pt.x * lptw->CharSize.x - lptw->ScrollPos.x;
00623       ypos = pt.y * lptw->CharSize.y - lptw->ScrollPos.y;
00624       count = lptw->ScreenSize.x - pt.x;
00625       if (mark)
00626         TextOut (hdc, xpos, ypos, (LPSTR) (lptw->ScreenBuffer + offset), count);
00627       else
00628         {
00629           DoLine (lptw, hdc, xpos, ypos, offset, count);
00630 
00631           SetTextColor (hdc, GetSysColor (COLOR_HIGHLIGHTTEXT));
00632           SetBkColor (hdc, GetSysColor (COLOR_HIGHLIGHT));
00633         }
00634       offset += count;
00635       pt.y++;
00636       pt.x = 0;
00637     }
00638   /* partial line */
00639   xpos = pt.x * lptw->CharSize.x - lptw->ScrollPos.x;
00640   ypos = pt.y * lptw->CharSize.y - lptw->ScrollPos.y;
00641   count = end.x - pt.x;
00642   if (end.y != lptw->ScreenSize.y)
00643     {
00644       if (mark)
00645         TextOut (hdc, xpos, ypos, (LPSTR) (lptw->ScreenBuffer + offset), count);
00646       else
00647         DoLine (lptw, hdc, xpos, ypos, offset, count);
00648     }
00649   (void) ReleaseDC (lptw->hWndText, hdc);
00650 }

Here is the call graph for this function:

Here is the caller graph for this function:

void EnableMenus ( LPTW  lptw  ) 

Definition at line 1995 of file wtext.c.

References EnableNMenus(), tagMW::hMenu, and tagTW::lpmw.

01996 {
01997   int Nums = GetMenuItemCount (lptw->lpmw->hMenu);
01998   EnableNMenus(lptw,Nums);
01999 }

Here is the call graph for this function:

void EnableNMenus ( LPTW  lptw,
int  numbermenus 
)

Definition at line 1985 of file wtext.c.

References tagMW::hMenu, tagTW::hWndParent, i, and tagTW::lpmw.

Referenced by ChangeCursorWhenScilabIsReady(), and EnableMenus().

01986 {
01987   int i=0;
01988   for(i=0;i<numbermenus;i++)
01989   {
01990           EnableMenuItem (lptw->lpmw->hMenu, i, MF_ENABLED| MF_BYPOSITION);
01991   }
01992   DrawMenuBar(lptw->hWndParent);        
01993 }

Here is the caller graph for this function:

void EnableToolBar ( LPTW  lptw  ) 

Definition at line 331 of file Toolbar.c.

References tagMW::hButton, i, tagTW::lpmw, tagMW::nButton, tagMW::ShowToolBar, and SW_SHOWNORMAL.

Referenced by ChangeCursorWhenScilabIsReady().

00332 {
00333         int i=0;
00334         if (lptw->lpmw->ShowToolBar)
00335         {
00336                 for (i = 0; i < lptw->lpmw->nButton; i++)
00337                 {
00338                         ShowWindow( lptw->lpmw->hButton[i] , SW_SHOWNORMAL );
00339                 }
00340         }
00341 }

Here is the caller graph for this function:

void EvaluateSelection ( LPTW  lptw  ) 

Definition at line 1206 of file wtext.c.

References hdc, tagTW::hfont, tagTW::hWndText, i, l, MALLOC, NULL, TextCopyClip(), TEXTMETRIC, type, UINT, and write_scilab_synchro().

01207 {
01208         HDC hdc;
01209         HGLOBAL hGMem;
01210         
01211         TEXTMETRIC tm;
01212         UINT type;
01213         LPSTR lpMem; /* Pointeur sur la chaine du clipboard */
01214         char *MessagePaste=NULL;
01215         
01216         
01217         /* Copie dans le presse papier */
01218         /* La zone sélectionnée */
01219         TextCopyClip (lptw);
01220                 
01221         /*Récupere ce qu'il y a dans le presse papier*/
01222         
01223         hdc = GetDC (lptw->hWndText);
01224         SelectFont (hdc, lptw->hfont);
01225         GetTextMetrics (hdc, (TEXTMETRIC *) & tm);
01226         if (tm.tmCharSet == OEM_CHARSET) type = CF_OEMTEXT;
01227         else type = CF_TEXT;
01228         ReleaseDC (lptw->hWndText, hdc);
01229         /* now get it from clipboard */
01230         OpenClipboard (lptw->hWndText);
01231         hGMem = GetClipboardData (type);
01232         if (hGMem)
01233         {
01234                 int i=0;
01235                 int l=0;
01236                 
01237                 lpMem= GlobalLock (hGMem);
01238                 l=strlen(lpMem);
01239                 MessagePaste=(char*)MALLOC(l*sizeof(char));
01240                 strcpy(MessagePaste,lpMem);
01241                 GlobalUnlock (hGMem);
01242         }
01243         CloseClipboard ();
01244         strcat(MessagePaste,"\n");
01245         write_scilab_synchro(MessagePaste);     
01246         
01247 }

Here is the call graph for this function:

void ExitWindow ( void   ) 

Definition at line 1736 of file wtext.c.

References tagTW::bGetCh, C2F, tagMW::CodeLanguage, FALSE, get_is_reading(), GetHandleThreadPaste(), GetTextWinScilab(), GetThreadPasteRunning(), tagTW::hWndParent, IsEnableTransparencyMode(), tagTW::lpmw, Message(), MSG_SCIMSG83, MSG_SCIMSG84, MSG_SCIMSG85, MSG_SCIMSG86, ScilabFxFadeOut(), sciquit(), SetThreadPasteRunning(), and WriteRegistryTxt().

01737 {
01738   char Message[255];
01739   char Title[50];
01740   LPTW lptw=GetTextWinScilab();
01741 
01742   if ( (get_is_reading()==FALSE) || (GetThreadPasteRunning()) )
01743   {
01744     if (GetThreadPasteRunning())SuspendThread(GetHandleThreadPaste());
01745     
01746     switch (lptw->lpmw->CodeLanguage)
01747     {
01748         case 1:
01749                 strcpy(Message,MSG_SCIMSG83);
01750                 strcpy(Title,MSG_SCIMSG84);
01751         break;
01752         case 0:default:
01753                 strcpy(Message,MSG_SCIMSG85);
01754                 strcpy(Title,MSG_SCIMSG86);
01755         break;
01756     }   
01757     
01758     if (MessageBox(lptw->hWndParent,Message,Title,MB_SYSTEMMODAL|MB_YESNO|MB_ICONWARNING)==IDYES)
01759     {
01760         /* Stop la thread Coller si en cours*/
01761         ResumeThread(GetHandleThreadPaste());
01762         if (GetThreadPasteRunning())
01763         {
01764                 TerminateThread(GetHandleThreadPaste(),1);
01765                 SetThreadPasteRunning(FALSE);
01766                 CloseHandle( GetHandleThreadPaste() );
01767         }
01768                 if (IsEnableTransparencyMode()) ScilabFxFadeOut();
01769         WriteRegistryTxt (lptw);
01770         C2F(sciquit)();
01771      }
01772      else
01773      {
01774         if (GetThreadPasteRunning()) ResumeThread(GetHandleThreadPaste());
01775      }
01776    }
01777    else
01778    {
01779            if (lptw->bGetCh)
01780            {
01781                    if (IsEnableTransparencyMode())      ScilabFxFadeOut();
01782                    WriteRegistryTxt (lptw);
01783                    C2F(sciquit)();
01784            }
01785            else
01786            {
01787                    switch (lptw->lpmw->CodeLanguage)
01788                    {
01789                         case 1:
01790                            strcpy(Message,MSG_SCIMSG83);
01791                            strcpy(Title,MSG_SCIMSG84);
01792                         break;
01793                         case 0:default:
01794                            strcpy(Message,MSG_SCIMSG85);
01795                            strcpy(Title,MSG_SCIMSG86);
01796                         break;
01797                    }   
01798 
01799                    if (MessageBox(lptw->hWndParent,Message,Title,MB_SYSTEMMODAL|MB_YESNO|MB_ICONWARNING)==IDYES)
01800                    {
01801                            if (IsEnableTransparencyMode())      ScilabFxFadeOut();
01802                            WriteRegistryTxt (lptw);
01803                            C2F(sciquit)();
01804                    }
01805            }
01806    }
01807 }

Here is the call graph for this function:

void ForceToActiveWindowParent ( void   ) 

Definition at line 1498 of file wtext.c.

References GetTextWinScilab(), and tagTW::hWndParent.

Referenced by sci_raise_window(), and Windows_Main().

01499 {
01500         LPTW lptw=GetTextWinScilab();
01501         
01502         while (GetForegroundWindow()!= lptw->hWndParent)
01503         {
01504                 SetForegroundWindow(lptw->hWndParent);
01505                 SetActiveWindow(lptw->hWndParent);
01506                 Sleep(1);
01507         }
01508 }

Here is the call graph for this function:

Here is the caller graph for this function:

int GetCurrentLanguage ( void   ) 

Definition at line 2013 of file wtext.c.

References tagMW::CodeLanguage, GetLanguageCodeInScilabDotStar(), GetTextWinScilab(), IsWindowInterface(), and tagTW::lpmw.

02014 {
02015         int ReturnLanguage=0;
02016 
02017         if (IsWindowInterface())
02018         {
02019                 LPTW lptw=GetTextWinScilab();
02020                 int IHMLanguage=lptw->lpmw->CodeLanguage;
02021                 ReturnLanguage=IHMLanguage;
02022         }
02023         else
02024         {
02025                 int SCILanguague=GetLanguageCodeInScilabDotStar();
02026                 ReturnLanguage=SCILanguague;
02027         }
02028         
02029         return ReturnLanguage;
02030 }

Here is the call graph for this function:

BOOL HasAZoneTextSelected ( LPTW  lptw  ) 

Definition at line 1377 of file wtext.c.

References FALSE, tagTW::MarkBegin, tagTW::MarkEnd, tagTW::ScreenSize, and TRUE.

01378 {
01379         BOOL ValRetour=FALSE;
01380         
01381         if  ( (lptw->ScreenSize.x * lptw->MarkBegin.y + lptw->MarkBegin.x) -
01382               (lptw->ScreenSize.x * lptw->MarkEnd.y + lptw->MarkEnd.x) != 0) 
01383               {ValRetour=TRUE;}
01384         
01385         return ValRetour;
01386 }

void HelpOn ( LPTW  lptw  ) 

Definition at line 1077 of file wtext.c.

References FREE, hdc, tagTW::hfont, tagTW::hWndText, i, l, MALLOC, MAX_PATH, NULL, StoreCommand1(), TextCopyClip(), TEXTMETRIC, type, and UINT.

01079 {
01080         HDC hdc;
01081         HGLOBAL hGMem;
01082         
01083         TEXTMETRIC tm;
01084         UINT type;
01085         LPSTR lpMem; /* Pointeur sur la chaine du clipboard */
01086         char *MessagePaste=NULL;
01087         char Command[MAX_PATH];
01088                 
01089         strcpy(Command,"");
01090         
01091         /* Copie dans le presse papier */
01092         /* La zone sélectionnée */
01093         TextCopyClip (lptw);
01094                 
01095         /*Récupere ce qu'il y a dans le presse papier*/
01096         
01097         hdc = GetDC (lptw->hWndText);
01098         SelectFont (hdc, lptw->hfont);
01099         GetTextMetrics (hdc, (TEXTMETRIC *) & tm);
01100         if (tm.tmCharSet == OEM_CHARSET) type = CF_OEMTEXT;
01101         else type = CF_TEXT;
01102         ReleaseDC (lptw->hWndText, hdc);
01103         /* now get it from clipboard */
01104         OpenClipboard (lptw->hWndText);
01105         hGMem = GetClipboardData (type);
01106         if (hGMem)
01107         {
01108                 int i=0;
01109                 int l=0;
01110                 
01111                 lpMem= GlobalLock (hGMem);
01112                 l=strlen(lpMem);
01113                 MessagePaste=(char*)MALLOC( (l+1)*sizeof(char));
01114                 strcpy(MessagePaste,lpMem);
01115                 MessagePaste[l]='\0';
01116                 GlobalUnlock (hGMem);
01117                 
01118                 /* On enleve les prompts */
01119                 /*CleanPromptFromText(MessagePaste);*/
01120                 
01121                 /* On enleve  : et retour chariot */
01122                 l=strlen(MessagePaste);
01123                 for (i=0;i<l;i++)
01124                 {
01125                         if (MessagePaste[i]==':') MessagePaste[i]=' ';
01126                         if (MessagePaste[i]=='\n') MessagePaste[i]=' ';
01127                         if (MessagePaste[i]=='\r') MessagePaste[i]=' ';
01128                 }       
01129 
01130         }
01131         CloseClipboard ();
01132         
01133         if (MessagePaste)
01134         {
01135                 
01136                 int minlen=strlen("help \"\"");
01137 
01138                 if ( strlen(MessagePaste)+minlen > MAX_PATH)
01139                 {
01140                         char MessageTMP[MAX_PATH];
01141                         strncpy(MessageTMP,MessagePaste,MAX_PATH-minlen);
01142                         wsprintf(Command,"help \"%s\"",MessageTMP);
01143                 }
01144                 else
01145                 {
01146                         wsprintf(Command,"help \"%s\"",MessagePaste);
01147                 }
01148                 
01149                 if (strcmp (Command,"help \"\"")!=0 ) StoreCommand1 (Command,0);
01150                 FREE(MessagePaste);
01151         }
01152         
01153 }

Here is the call graph for this function:

void InitScreenBuffer ( LPTW  lptw  ) 

Definition at line 1447 of file wtext.c.

References tagTW::AttrBuffer, tagTW::CharSize, tagTW::ClientSize, FALSE, tagTW::hWndText, max, min, NOTEXT, NULL, SB_VERT, tagTW::ScreenBuffer, tagTW::ScreenSize, tagTW::ScrollMax, tagTW::ScrollPos, szNoMemory, and TRUE.

Referenced by ClearCommandWindow().

01448 {
01449         HGLOBAL hglobal;
01450         
01451         /* Destruction du Screenbuffer */
01452         hglobal = GlobalHandle (lptw->ScreenBuffer);
01453         if (hglobal)
01454         {
01455                 GlobalUnlock (hglobal);
01456                 GlobalFree (hglobal);
01457         }
01458         
01459         hglobal = GlobalHandle (lptw->AttrBuffer);
01460         if (hglobal)
01461         {
01462                 GlobalUnlock (hglobal);
01463                 GlobalFree (hglobal);
01464         }
01465         
01466         /* Réinitialisation des dimensions */
01467         /*lptw->ScreenSize.x = ScrollSize.x; / * 80 par défaut*/
01468         /*lptw->ScreenSize.y = ScrollSize.y; / * 360 par défaut*/
01469         
01470         lptw->ScrollMax.y = max (0, lptw->CharSize.y * lptw->ScreenSize.y - lptw->ClientSize.y);
01471         lptw->ScrollPos.y = min (lptw->ScrollPos.y, lptw->ScrollMax.y);
01472 
01473         /* Allocation Memoire ScreenBuffer */   
01474         hglobal = GlobalAlloc (GHND, lptw->ScreenSize.x * lptw->ScreenSize.y);
01475 
01476         lptw->ScreenBuffer = (BYTE FAR *) GlobalLock (hglobal);
01477         if (lptw->ScreenBuffer == (BYTE FAR *) NULL)
01478         {
01479                 MessageBox ((HWND) NULL, szNoMemory, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
01480                 exit(1);
01481         }
01482         _fmemset (lptw->ScreenBuffer, ' ', lptw->ScreenSize.x * lptw->ScreenSize.y);
01483                 
01484         hglobal = GlobalAlloc (GHND, lptw->ScreenSize.x * lptw->ScreenSize.y);
01485         lptw->AttrBuffer = (BYTE FAR *) GlobalLock (hglobal);
01486         if (lptw->AttrBuffer == (BYTE FAR *) NULL)
01487         {
01488                 MessageBox ((HWND) NULL, szNoMemory, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
01489                 exit(1);
01490         }
01491         _fmemset (lptw->AttrBuffer, NOTEXT, lptw->ScreenSize.x * lptw->ScreenSize.y);
01492         
01493         SetScrollRange (lptw->hWndText, SB_VERT, 0, lptw->ScrollMax.y, FALSE);
01494         SetScrollPos (lptw->hWndText, SB_VERT, lptw->ScrollPos.y, TRUE);
01495         UpdateWindow (lptw->hWndText);
01496 }

Here is the caller graph for this function:

void InvalidateCursor ( void   ) 

Definition at line 1841 of file wtext.c.

01842 {
01843         POINT pt; // Screen coordinates!
01844         GetCursorPos( &pt );
01845         SetCursorPos( pt.x, pt.y );
01846 }

BOOL IsToThePrompt ( void   ) 

Definition at line 1974 of file wtext.c.

References tagTW::bGetCh, C2F, FALSE, get_is_reading(), GetTextWinScilab(), ismenu(), and TRUE.

01975 {
01976         BOOL retour=FALSE;
01977         LPTW lptw=GetTextWinScilab();
01978 
01979         if  (( ( C2F (ismenu) () == 1 ) || ( lptw->bGetCh == FALSE ) ) && (!get_is_reading()) ) retour=FALSE;
01980         else retour=TRUE;
01981 
01982         return retour;
01983 }

Here is the call graph for this function:

void LimitMark ( LPTW  lptw,
POINT FAR *  lppt 
)

Definition at line 506 of file wtext.c.

References tagTW::ScreenSize.

00507 {
00508   if (lppt->x < 0)
00509     lppt->x = 0;
00510   if (lppt->y < 0)
00511     {
00512       lppt->x = 0;
00513       lppt->y = 0;
00514     }
00515   if (lppt->x > lptw->ScreenSize.x)
00516     lppt->x = lptw->ScreenSize.x;
00517   if (lppt->y >= lptw->ScreenSize.y)
00518     {
00519       lppt->x = 0;
00520       lppt->y = lptw->ScreenSize.y;
00521     }
00522 }

void NewLine ( LPTW  lptw  ) 

Definition at line 359 of file wtext.c.

References tagTW::AttrBuffer, tagTW::CharSize, tagTW::CursorFlag, tagTW::CursorPos, tagTW::hWndText, i, LimitMark(), tagTW::MarkBegin, tagTW::MarkEnd, NOTEXT, NULL, tagTW::ScreenBuffer, tagTW::ScreenSize, and TextToCursor().

00360 {
00361         lptw->CursorPos.x = 0;
00362         lptw->CursorPos.y++;
00363         if (lptw->CursorPos.y >= lptw->ScreenSize.y) {
00364             int i =  lptw->ScreenSize.x * (lptw->ScreenSize.y - 1);
00365                 _fmemmove(lptw->ScreenBuffer, lptw->ScreenBuffer+lptw->ScreenSize.x, i);
00366                 _fmemset(lptw->ScreenBuffer + i, ' ', lptw->ScreenSize.x);
00367                 _fmemmove(lptw->AttrBuffer, lptw->AttrBuffer+lptw->ScreenSize.x, i);
00368                 _fmemset(lptw->AttrBuffer + i, NOTEXT, lptw->ScreenSize.x);
00369                 lptw->CursorPos.y--;
00370                 ScrollWindow(lptw->hWndText,0,-lptw->CharSize.y,NULL,NULL);
00371                 lptw->MarkBegin.y--;
00372                 lptw->MarkEnd.y--;
00373                 LimitMark(lptw, &lptw->MarkBegin);
00374                 LimitMark(lptw, &lptw->MarkEnd);
00375                 UpdateWindow(lptw->hWndText);
00376         }
00377         if (lptw->CursorFlag) TextToCursor(lptw);
00378         
00379 }

Here is the call graph for this function:

void OnRightClickMenu ( LPTW  lptw  ) 

Definition at line 1160 of file wtext.c.

References tagMW::CodeLanguage, tagTW::hPopMenu, tagTW::hWndText, tagTW::lpmw, M_COPY_CLIP, M_EVALSELECTION, M_HELPON, M_OPENSELECTION, M_PASTE, M_PRINTSELECTION, M_SELECT_ALL, MF_SEPARATOR, MSG_SCIMSG67, MSG_SCIMSG68, MSG_SCIMSG69, MSG_SCIMSG70, MSG_SCIMSG71, MSG_SCIMSG72, MSG_SCIMSG73, MSG_SCIMSG74, MSG_SCIMSG75, MSG_SCIMSG76, MSG_SCIMSG77, MSG_SCIMSG78, MSG_SCIMSG79, MSG_SCIMSG80, and NULL.

Referenced by SwitchLanguage(), and TextInit().

01162 {
01163   /* Modification Allan CORNET */
01164    
01165   if (lptw->hPopMenu) DestroyMenu(lptw->hPopMenu);      
01166   lptw->hPopMenu = CreatePopupMenu ();
01167   
01168   switch (lptw->lpmw->CodeLanguage)
01169   {
01170         case 1: /* French */
01171         {
01172                 /*AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED, M_CUT, "&Couper      Ctrl+X");*/
01173                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_ENABLED, M_SELECT_ALL, MSG_SCIMSG67);
01174                 AppendMenu (lptw->hPopMenu, MF_SEPARATOR, 0, NULL);
01175                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED, M_COPY_CLIP, MSG_SCIMSG68);
01176                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED, M_PASTE, MSG_SCIMSG69);
01177                 //AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED, M_SPECIALPASTE, "Coller &Special     Shft+V");
01178                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED,M_PRINTSELECTION, MSG_SCIMSG70);
01179                 AppendMenu (lptw->hPopMenu, MF_SEPARATOR, 0, NULL);
01180                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED,M_EVALSELECTION, MSG_SCIMSG71);
01181                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED,M_OPENSELECTION, MSG_SCIMSG72);
01182                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED,M_HELPON, MSG_SCIMSG73);
01183         }
01184         break;
01185         default: case 0: /*English */
01186         {
01187                 /*AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED, M_CUT, "C&ut Ctrl+X");*/
01188                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_ENABLED, M_SELECT_ALL, MSG_SCIMSG74);
01189                 AppendMenu (lptw->hPopMenu, MF_SEPARATOR, 0, NULL);
01190                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED, M_COPY_CLIP, MSG_SCIMSG75);
01191                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED, M_PASTE, MSG_SCIMSG76);
01192                 //AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED, M_SPECIALPASTE, "&Special Paste      Shft+V");
01193                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED,M_PRINTSELECTION, MSG_SCIMSG77);
01194                 AppendMenu (lptw->hPopMenu, MF_SEPARATOR, 0, NULL);
01195                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED,M_EVALSELECTION, MSG_SCIMSG78);
01196                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED,M_OPENSELECTION, MSG_SCIMSG79);
01197                 AppendMenu (lptw->hPopMenu, MF_STRING|MF_GRAYED,M_HELPON, MSG_SCIMSG80);
01198 
01199         }
01200         break;
01201   }
01202         SendMessage (lptw->hWndText, WM_LBUTTONUP,0, 0);  
01203         
01204 }

Here is the caller graph for this function:

void OpenSelection ( LPTW  lptw  ) 

Definition at line 1249 of file wtext.c.

References CTRLL, hdc, tagTW::hfont, tagTW::hWndText, i, IsAFile(), l, MALLOC, MAX_PATH, Message(), MSG_ERROR57, MSG_SCIMSG81, MSG_SCIMSG82, NULL, ReplaceSlash(), sciprint(), SendCTRLandAKey(), StoreCommand1(), TextCopyClip(), TEXTMETRIC, type, and UINT.

01251 {
01252         HDC hdc;
01253         HGLOBAL hGMem;
01254         
01255         TEXTMETRIC tm;
01256         UINT type;
01257         LPSTR lpMem; /* Pointeur sur la chaine du clipboard */
01258         char *MessagePaste=NULL;
01259         char FileName[MAX_PATH];
01260         char FileNameSCE[MAX_PATH];     
01261         char FileNameSCI[MAX_PATH];     
01262         char Command[MAX_PATH];
01263         
01264         
01265         /* Copie dans le presse papier */
01266         /* La zone sélectionnée */
01267         TextCopyClip (lptw);
01268                 
01269         /*Récupere ce qu'il y a dans le presse papier*/
01270         
01271         hdc = GetDC (lptw->hWndText);
01272         SelectFont (hdc, lptw->hfont);
01273         GetTextMetrics (hdc, (TEXTMETRIC *) & tm);
01274         if (tm.tmCharSet == OEM_CHARSET) type = CF_OEMTEXT;
01275         else type = CF_TEXT;
01276         ReleaseDC (lptw->hWndText, hdc);
01277         /* now get it from clipboard */
01278         OpenClipboard (lptw->hWndText);
01279         hGMem = GetClipboardData (type);
01280         if (hGMem)
01281         {
01282                 int i=0;
01283                 int l=0;
01284                 
01285                 lpMem= GlobalLock (hGMem);
01286                 l=strlen(lpMem);
01287                 MessagePaste=(char*)MALLOC(l*sizeof(char));
01288                 strcpy(MessagePaste,lpMem);
01289                 GlobalUnlock (hGMem);
01290                 
01291 
01292                 
01293                 
01294                 /* On enleve et retour chariot */
01295                 l=strlen(MessagePaste);
01296                 for (i=0;i<l;i++)
01297                 {
01298                         if (MessagePaste[i]=='\n') MessagePaste[i]='\0';
01299                         if (MessagePaste[i]=='\r') MessagePaste[i]='\0';
01300                 }       
01301         }
01302         CloseClipboard ();
01303         
01304         strcpy(FileName,MessagePaste);  
01305         
01306         strcpy(FileNameSCI,MessagePaste);
01307         strcat(FileNameSCI,".sci");
01308         
01309         strcpy(FileNameSCE,MessagePaste);
01310         strcat(FileNameSCE,".sce");
01311         
01312         //MessageBox(NULL,FileName,FileName,MB_OK);
01313         
01314         if ( IsAFile(FileNameSCI) )
01315         {
01316                 char Fichier[MAX_PATH];
01317                 GetShortPathName(FileNameSCI,Fichier,MAX_PATH);
01318                 ReplaceSlash(FileNameSCI,Fichier);
01319                 wsprintf(Command,"scipad('%s')",FileNameSCI);
01320                 
01321                 StoreCommand1 (Command, 0);
01322                 return ;                        
01323         }
01324         
01325         if ( IsAFile(FileNameSCE) )
01326         {
01327                 char Fichier[MAX_PATH];
01328                 GetShortPathName(FileNameSCE,Fichier,MAX_PATH);
01329                 ReplaceSlash(FileNameSCE,Fichier);
01330                 wsprintf(Command,"scipad('%s')",FileNameSCE);
01331                 StoreCommand1 (Command, 0);
01332                 return ;                        
01333         }
01334         
01335         if ( IsAFile(FileName) )
01336         {
01337                 char Fichier[MAX_PATH];
01338                 GetShortPathName(FileName,Fichier,MAX_PATH);
01339                 ReplaceSlash(FileName,Fichier);
01340                 //MessageBox(NULL,FileName,Fichier,MB_OK);
01341                 wsprintf(Command,"scipad('%s')",FileName);
01342                 StoreCommand1 (Command, 0);
01343                 return ;                        
01344         }
01345         else
01346         {
01347                 /*cree un fichier avec l'extension SCI */
01348                 char Message[MAX_PATH];
01349                 
01350                 wsprintf(Message,MSG_SCIMSG81,FileNameSCI);
01351                 if ( MessageBox(lptw->hWndText,Message,MSG_SCIMSG82,MB_YESNO|MB_ICONWARNING)== IDYES )
01352                 {
01353                         FILE *fp;
01354                         char Fichier[MAX_PATH];
01355                         
01356                         fp=fopen(FileNameSCI,"wt");
01357                         if ( fp )
01358                         {
01359                                 fclose(fp);
01360                                 GetShortPathName(FileNameSCI,Fichier,MAX_PATH);
01361                                 ReplaceSlash(FileNameSCI,Fichier);
01362                                 wsprintf(Command,"scipad('%s')",FileNameSCI);
01363                                 StoreCommand1 (Command, 0);                     
01364                         }
01365                         else
01366                         {
01367                                 sciprint(MSG_ERROR57);  
01368                                 SendCTRLandAKey(CTRLL);
01369                         }
01370                         
01371                 }
01372         }
01373         
01374         
01375 }

Here is the call graph for this function:

void PrintSelectionGUI ( LPTW  lptw,
char *  Entete 
)

Definition at line 9 of file TextToPrint.c.

References tagTW::hfont, tagTW::hWndText, and PrintSelection().

Referenced by Callback_PRINT(), and ON_WND_TEXT_WM_COMMAND().

00010 {
00011         PrintSelection(lptw->hWndText,Entete,lptw->hfont);
00012 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ReadRegistryTxt ( LPTW  lptw  ) 

Definition at line 22 of file registry.c.

References B, tagTW::bSysColors, FALSE, tagTW::fontname, tagTW::fontsize, G, Length(), tagMW::LockToolBar, tagTW::lpmw, MAX_PATH, tagTW::nCmdShow, NULL, tagTW::Origin, R, result, SCI_VERSION_STRING, SetIhmTextBackgroundColor(), SetIhmTextColor(), tagMW::ShowToolBar, tagTW::Size, size, TEXTFONTNAME, TEXTFONTSIZE, and TRUE.

Referenced by TextInit().

00023 {
00024         /* Modification Restauration depuis la base de registre dans 
00025                         HKEY_CURRENT_USER\\SOFTWARE\\Scilab\\"VERSION"\\Settings
00026         "Version" correspondant à la version de Scilab
00027         */
00028         HKEY key;
00029         DWORD result,Length,size=4;
00030         char Clef[MAX_PATH];
00031         int Iconic,iconic;
00032         int SizeX;
00033         int SizeY;
00034         int SysColors;
00035         DWORD TextColor;
00036     DWORD BackgroundColor;
00037         int Toolbar;
00038 //      int Language;
00039         char TextFontName[MAX_PATH];
00040         int TextFontSize;
00041         RECT rect;
00042         
00043         Length=MAX_PATH;
00044         
00045         wsprintf(Clef,"SOFTWARE\\Scilab\\%s\\Settings",SCI_VERSION_STRING);
00046         result=RegOpenKeyEx(HKEY_CURRENT_USER, Clef, 0, KEY_QUERY_VALUE , &key);
00047 
00048         if ( RegQueryValueEx(key, "TextOriginX", 0, NULL, (LPBYTE)&rect.left, &size) !=  ERROR_SUCCESS )
00049         {
00050                 lptw->Origin.x = CW_USEDEFAULT;
00051         }
00052         else
00053         {
00054                 lptw->Origin.x = rect.left;
00055         }
00056         
00057         if ( RegQueryValueEx(key, "TextOriginY", 0, NULL, (LPBYTE)&rect.top, &size) !=  ERROR_SUCCESS )
00058         {
00059                 lptw->Origin.y = CW_USEDEFAULT;
00060         }
00061         else
00062         {
00063                 lptw->Origin.y = rect.top;
00064         }
00065         
00066         if ( RegQueryValueEx(key, "TextSizeX", 0, NULL, (LPBYTE)&SizeX, &size) !=  ERROR_SUCCESS )
00067         {
00068                 lptw->Size.x = CW_USEDEFAULT;
00069         }
00070         else
00071         {
00072                 lptw->Size.x = SizeX;
00073         }
00074         
00075         if ( RegQueryValueEx(key, "TextSizeY", 0, NULL, (LPBYTE)&SizeY, &size) !=  ERROR_SUCCESS )
00076         {
00077                 lptw->Size.y = CW_USEDEFAULT;
00078         }
00079         else
00080         {
00081                 lptw->Size.y = SizeY;
00082         }
00083         
00084         if ( RegQueryValueEx(key, "TextMinimized", 0, NULL, (LPBYTE)&Iconic, &size) !=  ERROR_SUCCESS )
00085         {
00086                         iconic = 0;
00087         }
00088         else
00089         {
00090                         iconic = Iconic;
00091         }
00092         
00093         if ( RegQueryValueEx(key, "TextFontName", 0, NULL,(LPBYTE)TextFontName,&Length) !=  ERROR_SUCCESS )
00094         {
00095                 strcpy (lptw->fontname, TEXTFONTNAME);
00096         }
00097         else
00098         {
00099                 strcpy (lptw->fontname, TextFontName);
00100         }
00101         
00102         if ( RegQueryValueEx(key, "TextFontSize", 0, NULL, (LPBYTE)&TextFontSize, &size) !=  ERROR_SUCCESS )
00103         {
00104                 lptw->fontsize = TEXTFONTSIZE;
00105         }
00106         else
00107         {
00108                 lptw->fontsize = TextFontSize;
00109         }
00110         
00111         if ( RegQueryValueEx(key, "SysColors", 0, NULL, (LPBYTE)&SysColors, &size) !=  ERROR_SUCCESS )
00112         {
00113                 lptw->bSysColors = 1;
00114         }
00115         else
00116         {
00117                 lptw->bSysColors = SysColors;
00118         }
00119         
00120         if (lptw->bSysColors == 0)
00121         {
00122                 if ( RegQueryValueEx(key, "TextColor", 0, NULL, (LPBYTE)&TextColor, &size) !=  ERROR_SUCCESS )
00123                 {
00124                         int R,G,B;
00125                         R=GetRValue(GetSysColor (COLOR_WINDOW));
00126                         G=GetGValue(GetSysColor (COLOR_WINDOW));
00127                         B=GetBValue(GetSysColor (COLOR_WINDOW));
00128                         
00129                         SetIhmTextColor(R,G,B,FALSE);
00130                 }
00131                 else
00132                 {
00133                         int R,G,B;
00134                         R=GetRValue(TextColor);
00135                         G=GetGValue(TextColor);
00136                         B=GetBValue(TextColor);
00137 
00138                         SetIhmTextColor(R,G,B,FALSE);
00139                 }
00140 
00141                 if ( RegQueryValueEx(key, "BackgroundColor", 0, NULL, (LPBYTE)&BackgroundColor, &size) !=  ERROR_SUCCESS )
00142                 {
00143                         int R,G,B;
00144                         R=GetRValue(GetSysColor (COLOR_WINDOW));
00145                         G=GetGValue(GetSysColor (COLOR_WINDOW));
00146                         B=GetBValue(GetSysColor (COLOR_WINDOW));
00147 
00148                         SetIhmTextBackgroundColor(R,G,B,FALSE);
00149                 }
00150                 else
00151                 {
00152                         int R,G,B;
00153                         R=GetRValue(BackgroundColor);
00154                         G=GetGValue(BackgroundColor);
00155                         B=GetBValue(BackgroundColor);
00156 
00157                         SetIhmTextBackgroundColor(R,G,B,FALSE);
00158                 }
00159         }
00160         
00161         if ( RegQueryValueEx(key, "ToolBar", 0, NULL, (LPBYTE)&Toolbar, &size) !=  ERROR_SUCCESS )
00162         {
00163                 lptw->lpmw->ShowToolBar = TRUE;
00164         }
00165         else
00166         {
00167                 lptw->lpmw->ShowToolBar = Toolbar;
00168         }
00169 
00170         //if ( RegQueryValueEx(key, "Language", 0, NULL, (LPBYTE)&Language, &size) !=  ERROR_SUCCESS )
00171  //     {
00172         //      int CodeLanguageInScilabDotStar=GetLanguageCodeInScilabDotStar();
00173 
00174         //      if (CodeLanguageInScilabDotStar != -1)
00175         //      {
00176         //              lptw->lpmw->CodeLanguage = CodeLanguageInScilabDotStar;
00177         //      }
00178         //      else lptw->lpmw->CodeLanguage = 0; /* English Default*/
00179         //}
00180         //else
00181         //{
00182         //      int CodeLanguageInScilabDotStar=GetLanguageCodeInScilabDotStar();
00183 
00184         //      if (Language != CodeLanguageInScilabDotStar)
00185         //      {
00186         //              lptw->lpmw->CodeLanguage = CodeLanguageInScilabDotStar; 
00187         //      }
00188         //      else
00189         //      if  ( (Language == 0) || (Language == 1) )      lptw->lpmw->CodeLanguage = Language;
00190         //      else lptw->lpmw->CodeLanguage = 0; /* English Default*/
00191         //}
00192                 
00193         lptw->lpmw->LockToolBar=FALSE;
00194 
00195         if ( result == ERROR_SUCCESS ) RegCloseKey(key);
00196 
00197         if (iconic) lptw->nCmdShow = SW_SHOWMINIMIZED;
00198 
00199 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ReAllocScreenBuffer ( LPTW  lptw  ) 

Definition at line 1622 of file wtext.c.

References AddLines, tagTW::AttrBuffer, tagTW::CharSize, tagTW::CursorPos, FREE, MALLOC, memcpy(), NOTEXT, NULL, tagTW::ScreenBuffer, tagTW::ScreenSize, tagTW::ScrollMax, and szNoMemory.

Referenced by ResizeScreenBuffer().

01623 {
01624         #define AddLines 360 /* Ajout de l'equivalent d'une page initiale */
01625         
01626         HGLOBAL hglobal;
01627         int NombredeCaracteres=0;
01628         BYTE *CopyOfScreenBuffer=NULL;
01629         BYTE *CopyOfAttribBuffer=NULL;
01630         int NewScreenSizeY=0;
01631                 
01632         /* Nombre de caracteres réellement utilisé */
01633         NombredeCaracteres=lptw->CursorPos.y * lptw->ScreenSize.x + lptw->CursorPos.x;
01634         CopyOfScreenBuffer=(char*)MALLOC( (NombredeCaracteres+1)* sizeof(char));
01635         if (CopyOfScreenBuffer == NULL)
01636         {
01637                 MessageBox ((HWND) NULL, szNoMemory, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
01638                 return;
01639         }
01640         /* Copie des caracteres dans un buffer intermédiaire */
01641         strncpy(CopyOfScreenBuffer,(LPSTR)lptw->ScreenBuffer,NombredeCaracteres);
01642         
01643 
01644         /* Allocation du nouveau buffer */
01645         NewScreenSizeY=lptw->ScreenSize.y+AddLines;
01646         
01647         
01648         hglobal = GlobalHandle (lptw->ScreenBuffer);
01649         if (hglobal)
01650         {
01651                 GlobalUnlock (hglobal);
01652                 GlobalFree (hglobal);
01653         }
01654                 
01655         hglobal = GlobalAlloc (GHND, lptw->ScreenSize.x * NewScreenSizeY);
01656 
01657         lptw->ScreenBuffer = (BYTE FAR *) GlobalLock (hglobal);
01658         if (lptw->ScreenBuffer == (BYTE FAR *) NULL)
01659         {
01660                 MessageBox ((HWND) NULL, szNoMemory, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
01661                 exit(1);
01662         }
01663         /* initialisation du Screenbuffer */
01664         _fmemset (lptw->ScreenBuffer, ' ', lptw->ScreenSize.x * NewScreenSizeY);
01665         /* Recopie */
01666         memcpy(lptw->ScreenBuffer,CopyOfScreenBuffer,NombredeCaracteres);
01667         /* Libération du buffer intermédiaire */
01668         FREE(CopyOfScreenBuffer);
01669         
01670         /* Idem à ci-dessus pour le buffer des couleurs des caracteres */               
01671         CopyOfAttribBuffer=(char*)MALLOC( (NombredeCaracteres+1)* sizeof(char));
01672         if (CopyOfAttribBuffer == NULL)
01673         {
01674                 MessageBox ((HWND) NULL, szNoMemory, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
01675                 exit(1);
01676         }
01677         strncpy(CopyOfAttribBuffer,(LPSTR)lptw->AttrBuffer,NombredeCaracteres);
01678         hglobal = GlobalHandle (lptw->AttrBuffer);
01679         if (hglobal)
01680         {
01681                 GlobalUnlock (hglobal);
01682                 GlobalFree (hglobal);
01683         }
01684 
01685         hglobal = GlobalAlloc (GHND, lptw->ScreenSize.x * NewScreenSizeY);
01686         lptw->AttrBuffer = (BYTE FAR *) GlobalLock (hglobal);
01687         if (lptw->AttrBuffer == (BYTE FAR *) NULL)
01688         {
01689                 MessageBox ((HWND) NULL, szNoMemory, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
01690                 exit(1);
01691         }
01692         _fmemset (lptw->AttrBuffer, NOTEXT, lptw->ScreenSize.x * NewScreenSizeY);
01693         memcpy(lptw->AttrBuffer,CopyOfAttribBuffer,NombredeCaracteres);
01694         FREE(CopyOfAttribBuffer);
01695         
01696         /* Nouveau Max. de la scrollbar verticale */
01697         lptw->ScrollMax.y=lptw->ScrollMax.y+(lptw->CharSize.y*AddLines);
01698         
01699         lptw->ScreenSize.y=NewScreenSizeY;
01700 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ReorganizeScreenBuffer ( LPTW  lptw  ) 

Definition at line 1702 of file wtext.c.

References tagTW::AttrBuffer, tagTW::CharSize, tagTW::CursorPos, FREE, MALLOC, NOTEXT, NULL, RemoveLines, tagTW::ScreenBuffer, tagTW::ScreenSize, and tagTW::ScrollPos.

Referenced by ResizeScreenBuffer().

01703 {
01704         #define RemoveLines 120
01705         int DecalageY=0;
01706         int NombredeCaracteres=0;
01707         
01708         BYTE *CopyOfScreenBuffer=NULL;
01709         BYTE *CopyOfAttribBuffer=NULL;
01710         
01711                                 
01712     NombredeCaracteres=lptw->CursorPos.y * lptw->ScreenSize.x + lptw->CursorPos.x;
01713         
01714     DecalageY=lptw->ScreenSize.x*RemoveLines;
01715 
01716         
01717         CopyOfScreenBuffer=(char*)MALLOC( (NombredeCaracteres+1)* sizeof(char));
01718                         
01719     strncpy(CopyOfScreenBuffer,(LPSTR)(lptw->ScreenBuffer+DecalageY),NombredeCaracteres-DecalageY);
01720     _fmemset (lptw->ScreenBuffer, ' ', lptw->ScreenSize.x * lptw->ScreenSize.y);
01721     strncpy((LPSTR)lptw->ScreenBuffer,CopyOfScreenBuffer,NombredeCaracteres-DecalageY);
01722     FREE(CopyOfScreenBuffer);
01723                         
01724                         
01725     CopyOfAttribBuffer=(char*)MALLOC( (NombredeCaracteres+1)* sizeof(char));
01726     strncpy(CopyOfAttribBuffer,(LPSTR)(lptw->AttrBuffer+DecalageY),NombredeCaracteres-DecalageY);
01727     _fmemset (lptw->AttrBuffer, NOTEXT, lptw->ScreenSize.x * lptw->ScreenSize.y);
01728     strncpy((LPSTR)lptw->AttrBuffer,CopyOfAttribBuffer,NombredeCaracteres-DecalageY);
01729     FREE(CopyOfAttribBuffer);
01730         
01731         
01732     lptw->CursorPos.y=lptw->CursorPos.y-RemoveLines;
01733     lptw->ScrollPos.y=lptw->ScrollPos.y-(RemoveLines*lptw->CharSize.y);
01734 }

Here is the caller graph for this function:

int ReplacePrompt ( char *  Text,
char *  prompt 
)

Definition at line 1549 of file wtext.c.

References FALSE, FREE, j, l, MALLOC, NULL, and TRUE.

Referenced by CleanPromptFromText().

01551 {
01552         int Retour=FALSE;
01553         int l=0;
01554         char *TextTMP=NULL;
01555         char *LocalPrompt=NULL;
01556         
01557         char *OccurenceDebutPrompt=NULL;
01558         
01559         LocalPrompt=(char*)MALLOC((strlen(prompt)+1)*sizeof(char));
01560         TextTMP=(char*)MALLOC((strlen(Text)+1)*sizeof(char));
01561         
01562         strcpy(TextTMP,Text);
01563         strcpy(LocalPrompt,prompt);
01564         
01565         l=strlen(LocalPrompt);
01566 
01567         while ( OccurenceDebutPrompt = strstr(TextTMP,LocalPrompt) )
01568         {
01569                 int j=0;
01570                 if (OccurenceDebutPrompt)
01571                 {
01572                         for(j=0;j< (signed)(  strlen(OccurenceDebutPrompt)- strlen(LocalPrompt) );j++)          
01573                         {
01574                                 OccurenceDebutPrompt[j]=OccurenceDebutPrompt[j+strlen(LocalPrompt)];
01575                         }
01576                         OccurenceDebutPrompt[j]='\0';
01577                 Retour=TRUE;    
01578                 }       
01579 
01580         }
01581         
01582         strcpy(Text,TextTMP);           
01583         
01584         FREE(TextTMP);
01585         FREE(LocalPrompt);
01586         return Retour;
01587         
01588 }

Here is the caller graph for this function:

void ResizeScreenBuffer ( LPTW  lptw  ) 

Definition at line 1593 of file wtext.c.

References FALSE, tagTW::hWndText, ReAllocScreenBuffer(), ReorganizeScreenBuffer(), SB_HORZ, SB_VERT, ScreenBufferSizeMaxY, tagTW::ScreenSize, tagTW::ScrollMax, tagTW::ScrollPos, and TRUE.

01594 {
01595         #define ScreenBufferSizeMaxY 25200 /* Valeur pour compatibilité avec W9x */
01596         
01597         
01598         /* Limitation de la taille du buffer d'ecran */ 
01599         if (lptw->ScreenSize.y < ScreenBufferSizeMaxY )
01600         {
01601                 /* On agrandit le buffer écran */
01602                  ReAllocScreenBuffer(lptw);
01603         }
01604         else
01605         {
01606                 /* On remonte dans le buffer écran */
01607                 ReorganizeScreenBuffer(lptw);
01608 
01609         }
01610         
01611         /* Mise à jour Scrollbar*/
01612         SetScrollRange (lptw->hWndText, SB_VERT, 0, lptw->ScrollMax.y, FALSE);
01613         
01614         SetScrollPos (lptw->hWndText, SB_VERT, lptw->ScrollPos.y, TRUE);
01615 
01616         SetScrollPos (lptw->hWndText, SB_HORZ, lptw->ScrollPos.x, TRUE);
01617 
01618 
01619         
01620 }

Here is the call graph for this function:

void SelectAll ( LPTW  lptw,
BOOL  DoAMark 
)

Definition at line 1850 of file wtext.c.

References tagTW::CharSize, ClearMark(), tagTW::CursorPos, DoMark(), HasAZoneTextSelected(), tagTW::hPopMenu, tagTW::hWndText, M_COPY_CLIP, M_EVALSELECTION, M_HELPON, M_OPENSELECTION, M_PRINTSELECTION, tagTW::MarkBegin, tagTW::MarkEnd, pt, tagTW::ScrollPos, and TRUE.

01851 {
01852         POINT pt;
01853         pt.x = 0;
01854         pt.y = 0;
01855         pt.x = (pt.x + lptw->ScrollPos.x)/lptw->CharSize.x;
01856         pt.y = (pt.y + lptw->ScrollPos.y)/lptw->CharSize.y;
01857         ClearMark(lptw, pt);
01858 
01859         lptw->MarkBegin.x=0;
01860         lptw->MarkBegin.y=0;
01861         lptw->MarkEnd.x=lptw->CursorPos.x;
01862         lptw->MarkEnd.y=lptw->CursorPos.y;
01863 
01864         SendMessage (lptw->hWndText, WM_HSCROLL,SB_LEFT, (LPARAM) 0);
01865         SendMessage (lptw->hWndText, WM_VSCROLL, SB_TOP, (LPARAM) 0);
01866                   
01867 
01868         if (DoAMark)
01869         {
01870                 DoMark (lptw, lptw->MarkBegin,lptw->MarkEnd, TRUE);
01871         
01872         
01873         if ((lptw->ScreenSize.x * lptw->MarkBegin.y + lptw->MarkBegin.x) >
01874                         (lptw->ScreenSize.x * lptw->MarkEnd.y + lptw->MarkEnd.x))
01875         {
01876                 POINT tmp;
01877                 tmp.x = lptw->MarkBegin.x;
01878                 tmp.y = lptw->MarkBegin.y;
01879                 lptw->MarkBegin.x = lptw->MarkEnd.x;
01880                 lptw->MarkBegin.y = lptw->MarkEnd.y;
01881                 lptw->MarkEnd.x = tmp.x;
01882                 lptw->MarkEnd.y = tmp.y;
01883         }
01884 }
01885    if  ( HasAZoneTextSelected(lptw) )
01886   {
01887                 /* Zone Selectionnée --> Activation Menus */
01888                 EnableMenuItem(lptw->hPopMenu,M_COPY_CLIP,MF_ENABLED);
01889             EnableMenuItem(lptw->hPopMenu,M_HELPON,MF_ENABLED);
01890                 EnableMenuItem(lptw->hPopMenu,M_PRINTSELECTION,MF_ENABLED);
01891                 EnableMenuItem(lptw->hPopMenu,M_OPENSELECTION,MF_ENABLED);
01892                 EnableMenuItem(lptw->hPopMenu,M_EVALSELECTION,MF_ENABLED);
01893                 /* EnableMenuItem(lptw->hPopMenu,M_CUT,MF_ENABLED); */
01894                 
01895           }
01896 
01897 }

Here is the call graph for this function:

DWORD WINAPI SendInputText ( LPVOID  lpParam  ) 

Definition at line 49 of file clipboard.c.

References tagTW::bGetCh, C2F, count, FALSE, FREE, GetTextWinScilab(), hThreadPaste, i, ismenu(), IsReadyForAnewLign(), tagTW::KeyBuf, tagTW::KeyBufIn, tagTW::KeyBufOut, tagTW::KeyBufSize, MALLOC, NULL, PasteForThread, SetReadyOrNotForAnewLign(), TEMPOTOUCHE, ThreadPasteRunning, and TRUE.

Referenced by CreateThreadPaste().

00051 {
00052         #define TEMPOTOUCHE  1
00053         int lg=0;
00054         int i=0;
00055         
00056         char *TextToSend=NULL;
00057         
00058         LPTW lptw=GetTextWinScilab();
00059         
00060         ThreadPasteRunning=TRUE;
00061         
00062         lg=strlen((char*)PasteForThread)+1;
00063         TextToSend=(char*)MALLOC(lg*sizeof(char));
00064         strcpy(TextToSend,(char*)PasteForThread);
00065         TextToSend[strlen(TextToSend)]='\0';
00066 
00067         FREE(PasteForThread);
00068         PasteForThread=NULL;
00069 
00070         //if (SpecialPaste==TRUE)CleanPromptFromText(TextToSend); /* Desactiver pour le moment */
00071                 
00072         while ( C2F (ismenu) () == 1 ) {Sleep(TEMPOTOUCHE);}
00073         /* Il n'y a plus rien dans la queue des commandes */
00074         while ( lptw->bGetCh == FALSE ) {Sleep(TEMPOTOUCHE);}
00075         /* Nous sommes au prompt */
00076         
00077         
00078         lg=strlen(TextToSend);
00079         i=0;
00080         while(i<lg)
00081         {
00082                 long count;
00083                 
00084                 
00085                 count = lptw->KeyBufIn - lptw->KeyBufOut;
00086                         
00087                 if (count < 0) count = count+lptw->KeyBufSize;
00088                 if (count < (long) (lptw->KeyBufSize-1)) 
00089                         {
00090                                 if (TextToSend[i] == '\t') *lptw->KeyBufIn++ = ' ';
00091                                 else *lptw->KeyBufIn++ = TextToSend[i];
00092                                 if (lptw->KeyBufIn - lptw->KeyBuf >= (signed)lptw->KeyBufSize)
00093                                 lptw->KeyBufIn = lptw->KeyBuf;  /* wrap around */
00094                         }
00095         
00096                 if (TextToSend[i]==10) 
00097                         {
00098                                 /* LF not preceded by a CR */
00099                                 /* fool it: turn LF into CR */
00100                                 /* Bug 1960 corrected - Francois VOGEL June 2006 */
00101                                 *lptw->KeyBufIn = 13;
00102                                 SetReadyOrNotForAnewLign(FALSE);
00103                                 while ( IsReadyForAnewLign() == FALSE ) {Sleep(TEMPOTOUCHE);}
00104                                 while ( C2F (ismenu) () == 1 ) {Sleep(TEMPOTOUCHE);}
00105                                 while ( lptw->bGetCh == FALSE ) {Sleep(TEMPOTOUCHE);}
00106                         }
00107                 if (TextToSend[i]==13) 
00108                         {
00109                                 SetReadyOrNotForAnewLign(FALSE);
00110                                 while ( IsReadyForAnewLign() == FALSE ) {Sleep(TEMPOTOUCHE);}
00111                                 while ( C2F (ismenu) () == 1 ) {Sleep(TEMPOTOUCHE);}
00112                                 while ( lptw->bGetCh == FALSE ) {Sleep(TEMPOTOUCHE);}
00113                                 if (i<lg-1)
00114                                 {
00115                                         /* skip LF that follows CR*/
00116                                         if (TextToSend[i+1]==10) i++;
00117                                 }
00118                         }
00119                 i++;    
00120                 
00121         }
00122 
00123         
00124         FREE(TextToSend);
00125         TextToSend=NULL;
00126         ThreadPasteRunning=FALSE;
00127         CloseHandle( hThreadPaste );
00128         
00129         return 0;       
00130 }

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT void WINAPI TextClearEOL ( LPTW  lptw  ) 

Definition at line 965 of file wtext.c.

References tagTW::AttrBuffer, tagTW::CharSize, ClearMark(), tagTW::CursorPos, GetIhmTextBackgroundColor(), GetIhmTextColor(), hdc, tagTW::hfont, tagTW::hWndText, len, NOTEXT, pt, tagTW::ScreenBuffer, tagTW::ScreenSize, tagTW::ScrollPos, and void().

00966 {
00967 HDC hdc;
00968 int xpos, ypos;
00969 int from, len;
00970 POINT pt;
00971         pt.x = pt.y = 0;
00972         ClearMark(lptw, pt);
00973         from = lptw->CursorPos.y*lptw->ScreenSize.x + lptw->CursorPos.x;
00974         len = lptw->ScreenSize.x-lptw->CursorPos.x;
00975         _fmemset(lptw->ScreenBuffer + from, ' ', len);
00976         _fmemset(lptw->AttrBuffer + from, NOTEXT, len);
00977         xpos = lptw->CursorPos.x*lptw->CharSize.x - lptw->ScrollPos.x;
00978         ypos = lptw->CursorPos.y*lptw->CharSize.y - lptw->ScrollPos.y;
00979         hdc = GetDC(lptw->hWndText);
00980 
00981         SetTextColor(hdc, GetIhmTextColor());
00982         SetBkColor(hdc, GetIhmTextBackgroundColor());
00983         
00984         SelectObject(hdc, (lptw->hfont));
00985         TextOut(hdc,xpos,ypos,
00986                 (LPSTR)(lptw->ScreenBuffer + lptw->CursorPos.y*lptw->ScreenSize.x + 
00987                 lptw->CursorPos.x), lptw->ScreenSize.x-lptw->CursorPos.x);
00988         (void)ReleaseDC(lptw->hWndText,hdc);
00989 }

Here is the call graph for this function:

EXPORT void WINAPI TextClearEOS ( LPTW  lptw  ) 

Definition at line 993 of file wtext.c.

References tagTW::AttrBuffer, ClearMark(), tagTW::CursorPos, tagTW::hWndText, len, NOTEXT, pt, tagTW::ScreenBuffer, and tagTW::ScreenSize.

00994 {
00995   RECT rect;
00996   int from, len;
00997   POINT pt;
00998   pt.x = pt.y = 0;
00999   ClearMark (lptw, pt);
01000   from = lptw->CursorPos.y * lptw->ScreenSize.x + lptw->CursorPos.x;
01001   len = lptw->ScreenSize.x - lptw->CursorPos.x +
01002     (lptw->ScreenSize.y - lptw->CursorPos.y - 1) * lptw->ScreenSize.x;
01003   _fmemset(lptw->ScreenBuffer + from, ' ', len);
01004   _fmemset(lptw->AttrBuffer + from, NOTEXT, len);
01005   GetClientRect (lptw->hWndText, (LPRECT) & rect);
01006   InvalidateRect (lptw->hWndText, (LPRECT) & rect, 1);
01007   UpdateWindow (lptw->hWndText);
01008 }

Here is the call graph for this function:

EXPORT void WINAPI TextClose ( LPTW  lptw  ) 

Definition at line 295 of file wtext.c.

References tagTW::AttrBuffer, CloseMacros(), tagTW::hWndParent, tagTW::KeyBuf, tagTW::lpmw, NULL, tagTW::ScreenBuffer, and TextMessage().

00296 {
00297   HGLOBAL hglobal;
00298 
00299   /* close window */
00300   if (lptw->hWndParent)DestroyWindow (lptw->hWndParent);
00301   TextMessage ();
00302 
00303   hglobal = GlobalHandle (lptw->ScreenBuffer);
00304   if (hglobal)
00305     {
00306       GlobalUnlock (hglobal);
00307       GlobalFree (hglobal);
00308     }
00309   hglobal = GlobalHandle (lptw->AttrBuffer);
00310   if (hglobal)
00311     {
00312       GlobalUnlock (hglobal);
00313       GlobalFree (hglobal);
00314     }
00315   hglobal = GlobalHandle (lptw->KeyBuf);
00316   if (hglobal)
00317     {
00318       GlobalUnlock (hglobal);
00319       GlobalFree (hglobal);
00320     }
00321 
00322   if (lptw->lpmw)  CloseMacros (lptw);
00323   lptw->hWndParent = (HWND) NULL;
00324 }

Here is the call graph for this function:

void TextCopyClip ( LPTW  lptw  ) 

Definition at line 206 of file clipboard.c.

References count, hdc, tagTW::MarkBegin, tagTW::MarkEnd, NULL, pt, tagTW::ScreenBuffer, tagTW::ScreenSize, size, TEXTMETRIC, type, and UINT.

Referenced by Callback_MCOPY(), Callback_PRINT(), CtrlCHit(), EvaluateSelection(), HelpOn(), ON_WND_TEXT_WM_COMMAND(), ON_WND_TEXT_WM_KEY(), OpenSelection(), and TextGetCh().

00207 {
00208         int size, count;
00209         HGLOBAL hGMem;
00210         LPSTR cbuf, cp;
00211         POINT pt, end;
00212         TEXTMETRIC tm;
00213         UINT type;
00214         HDC hdc;
00215 
00216         if ((lptw->MarkBegin.x == lptw->MarkEnd.x) && 
00217             (lptw->MarkBegin.y == lptw->MarkEnd.y) ) {
00218                 /* copy user text */
00219                 return;
00220         }
00221 
00222         size = (lptw->MarkEnd.y - lptw->MarkBegin.y + 1) 
00223                 * (lptw->ScreenSize.x + 2) + 1;
00224         hGMem = GlobalAlloc(GMEM_MOVEABLE, (DWORD)size);
00225         cbuf = cp = (LPSTR)GlobalLock(hGMem);
00226         if (cp == (LPSTR)NULL)
00227                 return;
00228         
00229         pt.x = lptw->MarkBegin.x;
00230         pt.y = lptw->MarkBegin.y;
00231         end.x   = lptw->MarkEnd.x;
00232         end.y   = lptw->MarkEnd.y;
00233 
00234         while (pt.y < end.y) {
00235                 /* copy to global buffer */
00236                 count = lptw->ScreenSize.x - pt.x;
00237                 _fmemcpy(cp, lptw->ScreenBuffer + lptw->ScreenSize.x*pt.y+pt.x, count);
00238                 /* remove trailing spaces */
00239                 for (count=count-1; count>=0; count--) {
00240                         if (cp[count]!=' ')
00241                                 break;
00242                         cp[count] = '\0';
00243                 }
00244                 cp[++count] = '\r';
00245                 cp[++count] = '\n';
00246                 cp[++count] = '\0';
00247                 cp += count;
00248                 pt.y++;
00249                 pt.x=0;
00250         }
00251         /* partial line */
00252         count = end.x - pt.x;
00253         if (end.y != lptw->ScreenSize.y) {
00254                 _fmemcpy(cp, lptw->ScreenBuffer + lptw->ScreenSize.x*pt.y+pt.x, count);
00255                 cp[count] = '\0';
00256         }
00257         size = _fstrlen(cbuf) + 1;
00258         GlobalUnlock(hGMem);
00259         hGMem = GlobalReAlloc(hGMem, (DWORD)size, GMEM_MOVEABLE);
00260         /* find out what type to put into clipboard */
00261         hdc = (HDC)TryToGetDC(lptw->hWndText);
00262         SelectObject(hdc, lptw->hfont);
00263         GetTextMetrics(hdc,(TEXTMETRIC FAR *)&tm);
00264         if (tm.tmCharSet == OEM_CHARSET)
00265                 type = CF_OEMTEXT;
00266         else
00267                 type = CF_TEXT;
00268         ReleaseDC(lptw->hWndText, hdc);
00269         /* give buffer to clipboard */
00270         OpenClipboard(lptw->hWndParent);
00271         EmptyClipboard();
00272         SetClipboardData(type, hGMem);
00273         CloseClipboard();
00274 }

Here is the caller graph for this function:

EXPORT void WINAPI TextCursorHeight ( LPTW  lptw,
int  height 
)

Definition at line 958 of file wtext.c.

References tagTW::bFocus, tagTW::CaretHeight, tagTW::CharSize, and tagTW::hWndText.

00959 {
00960   lptw->CaretHeight = height;
00961   if (lptw->bFocus)
00962     CreateCaret (lptw->hWndText, 0, lptw->CharSize.x, 2 + lptw->CaretHeight);
00963 }

EXPORT void WINAPI TextDeleteLine ( LPTW  lptw  ) 

Definition at line 1030 of file wtext.c.

References tagTW::AttrBuffer, ClearMark(), tagTW::CursorFlag, tagTW::CursorPos, tagTW::hWndText, len, NOTEXT, pt, tagTW::ScreenBuffer, tagTW::ScreenSize, and TextToCursor().

01031 {
01032   RECT rect;
01033   int from, to, len;
01034   POINT pt;
01035   pt.x = pt.y = 0;
01036   ClearMark (lptw, pt);
01037   to = lptw->CursorPos.y * lptw->ScreenSize.x,
01038     from = (lptw->CursorPos.y + 1) * lptw->ScreenSize.x;
01039   len = (lptw->ScreenSize.y - lptw->CursorPos.y - 1) * lptw->ScreenSize.x;
01040   _fmemmove(lptw->ScreenBuffer + to, lptw->ScreenBuffer + from, len);
01041   _fmemmove(lptw->AttrBuffer + to, lptw->AttrBuffer + from, len);
01042   from = lptw->ScreenSize.x * (lptw->ScreenSize.y - 1);
01043   _fmemset(lptw->ScreenBuffer + from, ' ', lptw->ScreenSize.x);
01044   _fmemset(lptw->AttrBuffer + from, NOTEXT, lptw->ScreenSize.x);
01045   GetClientRect (lptw->hWndText, (LPRECT) & rect);
01046   InvalidateRect (lptw->hWndText, (LPRECT) & rect, 1);
01047   UpdateWindow (lptw->hWndText);
01048   if (lptw->CursorFlag) TextToCursor (lptw);
01049 }

Here is the call graph for this function:

EXPORT int WINAPI TextGetCh ( LPTW  lptw  ) 

Definition at line 806 of file wtext.c.

References tagTW::bFocus, tagTW::bGetCh, tagTW::CaretHeight, tagTW::CharAscent, tagTW::CharSize, CTRLE, tagTW::CursorPos, FALSE, GetThreadPasteRunning(), HasAZoneTextSelected(), tagTW::hWndText, tagTW::KeyBuf, tagTW::KeyBufOut, tagTW::KeyBufSize, tagTW::ScrollPos, SendCTRLandAKey(), TextCopyClip(), TextKBHit(), TextMessage(), TextToCursor(), TRUE, and WriteInKeyBuf.

00807 {
00808   int ch;
00809   
00810   lptw->bGetCh = TRUE;
00811   
00812   TextToCursor (lptw);
00813   
00814   if (lptw->bFocus)
00815     {
00816       SetCaretPos (lptw->CursorPos.x * lptw->CharSize.x - lptw->ScrollPos.x,
00817                    lptw->CursorPos.y * lptw->CharSize.y + lptw->CharAscent
00818                    - lptw->CaretHeight - lptw->ScrollPos.y);
00819       ShowCaret (lptw->hWndText);
00820     }
00821 
00832   do 
00833   {
00834     if ( (!GetThreadPasteRunning()) && (!WriteInKeyBuf) ) Sleep(1); 
00835     TextMessage();
00836   } while (!TextKBHit(lptw));
00837   
00838   ch = *lptw->KeyBufOut++;
00839   
00840   
00841   /* Interception de Ctrl+C */
00842   if (ch == (char)3) 
00843   {
00844         if ( HasAZoneTextSelected(lptw) )
00845           {
00846                 TextCopyClip(lptw);
00847                 SendCTRLandAKey(CTRLE);
00848                 return 1;
00849                 
00850           }
00851   }
00852   
00853   if (lptw->KeyBufOut - lptw->KeyBuf >= (int) lptw->KeyBufSize)   lptw->KeyBufOut = lptw->KeyBuf;       /* wrap around */
00854 
00855   if (lptw->bFocus)  HideCaret (lptw->hWndText);
00856   
00857   lptw->bGetCh = FALSE;
00858   return ch;
00859   
00860 }

Here is the call graph for this function:

EXPORT int WINAPI TextGetChE ( LPTW  lptw  ) 

Definition at line 896 of file wtext.c.

References TextGetCh(), and TextPutCh().

00897 {
00898   int ch;
00899   ch = TextGetCh (lptw);
00900   TextPutCh (lptw, (BYTE) ch);
00901   return ch;
00902 }

Here is the call graph for this function:

EXPORT LPSTR WINAPI TextGetS ( LPTW  lptw,
LPSTR  str,
unsigned int  size 
)

Definition at line 904 of file wtext.c.

References NULL, and TextGetChE().

00905 {
00906   LPSTR next = str;
00907   
00908   while (--size > 0)
00909     {
00910       switch (*next = TextGetChE (lptw))
00911         {
00912         case EOF:
00913           *next = '\0';
00914           if (next == str)
00915             return (char *) NULL;
00916           return str;
00917         case '\n':
00918           *(next + 1) = '\0';
00919           return str;
00920         case 0x08:
00921         case 0x7f:
00922           if (next > str)
00923             --next;
00924           break;
00925         default:
00926           ++next;
00927         }
00928     }
00929   *next = '\0';
00930   return str;
00931 }

Here is the call graph for this function:

EXPORT void WINAPI TextGotoXY ( LPTW  lptw,
int  x,
int  y 
)

Definition at line 942 of file wtext.c.

References tagTW::CursorPos.

00943 {
00944   lptw->CursorPos.x = x;
00945   lptw->CursorPos.y = y;
00946 }

EXPORT int WINAPI TextInit ( LPTW  lptw  ) 

Definition at line 181 of file wtext.c.

References tagTW::Attr, tagTW::AttrBuffer, tagTW::bFocus, tagTW::bGetCh, tagTW::bSysColors, tagTW::ButtonHeight, tagTW::CaretHeight, CreateTextClass(), tagTW::CursorPos, DisableMenus(), DisableToolBar(), FALSE, tagTW::hInstance, tagTW::hPrevInstance, tagTW::hWndParent, tagTW::hWndText, InitIhmDefaultColor(), tagTW::KeyBuf, KeyBufferSize, tagTW::KeyBufIn, tagTW::KeyBufOut, tagTW::KeyBufSize, LoadMacros(), tagTW::lpmw, M_ABOUT, M_CONSOLE, MF_SEPARATOR, MSG_ERROR54, MSG_ERROR55, MSG_SCIMSG56, MSG_SCIMSG57, tagTW::nCmdShow, NOTEXT, NULL, OnRightClickMenu(), tagTW::Origin, ReadRegistryTxt(), ReLoadMenus(), tagTW::ScreenBuffer, tagTW::ScreenSize, ScrollSize, SetFocus(), tagTW::Size, SW_SHOWNORMAL, szNoMemory, szParentClass, szTextClass, TextMessage(), tagTW::Title, and ToolBarOnOff().

00182 {
00183   RECT rect;
00184   HMENU sysmenu;
00185   HGLOBAL hglobal;
00186   
00187   lptw->hWndParent=NULL;
00188   lptw->hWndText=NULL;
00189 
00190   ReadRegistryTxt (lptw);
00191   if (lptw->bSysColors) InitIhmDefaultColor();
00192 
00193   if (!lptw->hPrevInstance)    CreateTextClass (lptw);
00194 
00195   if (lptw->KeyBufSize == 0)    lptw->KeyBufSize = KeyBufferSize;
00196 
00197    /* Modified by D.Abdemouche 20/05/03 */
00198   if (lptw->ScreenSize.x < ScrollSize.x)  lptw->ScreenSize.x = ScrollSize.x;
00199   if (lptw->ScreenSize.y < ScrollSize.y)  lptw->ScreenSize.y = ScrollSize.y;
00200 
00201   lptw->CursorPos.x = lptw->CursorPos.y = 0;
00202   lptw->bFocus = FALSE;
00203   lptw->bGetCh = FALSE;
00204   lptw->CaretHeight = 0;
00205   if (!lptw->nCmdShow)
00206     lptw->nCmdShow = SW_SHOWNORMAL;
00207   if (!lptw->Attr)
00208     lptw->Attr = 0xf0;          /* black on white */
00209 
00210   hglobal = GlobalAlloc (GHND, lptw->ScreenSize.x * lptw->ScreenSize.y);
00211 
00212   /* sauvegarde de hglobal pour reallocation ultérieure */
00213   lptw->ScreenBuffer = (BYTE FAR *) GlobalLock (hglobal);
00214   if (lptw->ScreenBuffer == (BYTE FAR *) NULL)
00215     {
00216       MessageBox ((HWND) NULL, szNoMemory, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
00217       return (1);
00218     }
00219   _fmemset (lptw->ScreenBuffer, ' ', lptw->ScreenSize.x * lptw->ScreenSize.y);
00220   hglobal = GlobalAlloc (GHND, lptw->ScreenSize.x * lptw->ScreenSize.y);
00221   lptw->AttrBuffer = (BYTE FAR *) GlobalLock (hglobal);
00222   if (lptw->AttrBuffer == (BYTE FAR *) NULL)
00223     {
00224       MessageBox ((HWND) NULL, szNoMemory, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
00225       return (1);
00226     }
00227   _fmemset (lptw->AttrBuffer, NOTEXT, lptw->ScreenSize.x * lptw->ScreenSize.y);
00228   
00229   hglobal = GlobalAlloc (GHND, lptw->KeyBufSize);
00230     /* hglobal = GlobalAlloc (LHND, lptw->KeyBufSize); */
00231   /* Modification Allan CORNET LHND pour LocalAlloc et non pour GlobalAlloc*/
00232   lptw->KeyBuf = (BYTE FAR *) GlobalLock (hglobal);
00233   
00234   if (lptw->KeyBuf == (BYTE FAR *) NULL)
00235     {
00236       MessageBox ((HWND) NULL, szNoMemory, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
00237       return (1);
00238     }
00239   _fmemset (lptw->KeyBuf, ' ', lptw->KeyBufSize);  
00240   lptw->KeyBufIn = lptw->KeyBufOut = lptw->KeyBuf;
00241   
00242   
00243   lptw->hWndParent = CreateWindow (szParentClass, lptw->Title,
00244                                    WS_OVERLAPPEDWINDOW,
00245                                    lptw->Origin.x, lptw->Origin.y,
00246                                    lptw->Size.x, lptw->Size.y,
00247                                    NULL, NULL, lptw->hInstance, lptw);
00248 
00249   if (lptw->hWndParent == (HWND) NULL)
00250     {
00251       MessageBox ((HWND) NULL, MSG_ERROR54, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
00252       return (1);
00253     }
00254   ShowWindow (lptw->hWndParent, lptw->nCmdShow);
00255   GetClientRect (lptw->hWndParent, &rect);
00256 
00257   lptw->hWndText = CreateWindow (szTextClass, lptw->Title,
00258                                  WS_CHILD | WS_VSCROLL | WS_HSCROLL,
00259                                  0, lptw->ButtonHeight,
00260                                rect.right, rect.bottom - lptw->ButtonHeight,
00261                              lptw->hWndParent, NULL, lptw->hInstance, lptw);
00262                              
00263   if (lptw->hWndText == (HWND) NULL)
00264     {
00265       MessageBox ((HWND) NULL, MSG_ERROR55, (LPSTR) NULL, MB_ICONHAND | MB_SYSTEMMODAL);
00266       return (1);
00267     }
00268     
00269   OnRightClickMenu(lptw) ; 
00270  
00271   sysmenu = GetSystemMenu (lptw->hWndParent, 0);        /* get the sysmenu */
00272   AppendMenu (sysmenu, MF_SEPARATOR, 0, NULL);
00273   AppendMenu (sysmenu, MF_STRING, M_CONSOLE, MSG_SCIMSG56);
00274   AppendMenu (sysmenu, MF_SEPARATOR, 0, NULL);
00275   AppendMenu (sysmenu, MF_STRING, M_ABOUT, MSG_SCIMSG57);
00276 
00277   if (lptw->lpmw)    LoadMacros (lptw);
00278   ReLoadMenus(lptw);
00279 
00280   DisableMenus(lptw);
00281 
00282   ToolBarOnOff(lptw);
00283   DisableToolBar(lptw);
00284   OnRightClickMenu(lptw);
00285 
00286   ShowWindow (lptw->hWndText, SW_SHOWNORMAL);
00287   BringWindowToTop (lptw->hWndText);
00288   SetFocus (lptw->hWndText);
00289   TextMessage ();
00290   
00291   return (0);
00292 }

Here is the call graph for this function:

EXPORT void WINAPI TextInsertLine ( LPTW  lptw  ) 

Definition at line 1010 of file wtext.c.

References tagTW::AttrBuffer, ClearMark(), tagTW::CursorFlag, tagTW::CursorPos, tagTW::hWndText, len, NOTEXT, pt, tagTW::ScreenBuffer, tagTW::ScreenSize, and TextToCursor().

01011 {
01012   RECT rect;
01013   int from, to, len;
01014   POINT pt;
01015   pt.x = pt.y = 0;
01016   ClearMark (lptw, pt);
01017   from = lptw->CursorPos.y * lptw->ScreenSize.x,
01018     to = (lptw->CursorPos.y + 1) * lptw->ScreenSize.x;
01019   len = (lptw->ScreenSize.y - lptw->CursorPos.y - 1) * lptw->ScreenSize.x;
01020   _fmemmove(lptw->ScreenBuffer + to, lptw->ScreenBuffer + from, len);
01021   _fmemmove(lptw->AttrBuffer + to, lptw->AttrBuffer + from, len);
01022   _fmemset(lptw->ScreenBuffer + from, ' ', lptw->ScreenSize.x);
01023   _fmemset(lptw->AttrBuffer + from, NOTEXT, lptw->ScreenSize.x);
01024   GetClientRect (lptw->hWndText, (LPRECT) & rect);
01025   InvalidateRect (lptw->hWndText, (LPRECT) & rect, 1);
01026   UpdateWindow (lptw->hWndText);
01027   if (lptw->CursorFlag)    TextToCursor (lptw);
01028 }

Here is the call graph for this function:

EXPORT int WINAPI TextKBHit ( LPTW  lptw  ) 

Definition at line 795 of file wtext.c.

References tagTW::KeyBufIn, and tagTW::KeyBufOut.

00796 {
00797   return (lptw->KeyBufIn != lptw->KeyBufOut);
00798 }

void TextMakeFont ( LPTW  lptw  ) 

Definition at line 702 of file wtext.c.

References tagTW::bFocus, tagTW::CaretHeight, tagTW::CharAscent, tagTW::CharSize, tagTW::fontname, tagTW::fontsize, hdc, tagTW::hfont, tagTW::hWndText, int, memset(), NULL, p, SCI_DEFAULT_CHARSET, TEXTMETRIC, and TRUE.

00703 {
00704   LOGFONT lf;
00705   TEXTMETRIC tm;
00706   LPSTR p;
00707   HDC hdc;
00708 
00709   hdc = GetDC (lptw->hWndText);
00710   memset (&lf, 0, sizeof (LOGFONT));
00711   strncpy (lf.lfFaceName, lptw->fontname, LF_FACESIZE);
00712   lf.lfHeight = -MulDiv (lptw->fontsize, GetDeviceCaps (hdc, LOGPIXELSY), 72);
00713   lf.lfPitchAndFamily = FIXED_PITCH;
00714   lf.lfCharSet = SCI_DEFAULT_CHARSET;
00715   if ((p = strstr (lptw->fontname, " Italic")) != (LPSTR) NULL)
00716     {
00717       lf.lfFaceName[(unsigned int) (p - lptw->fontname)] = '\0';
00718       lf.lfItalic = TRUE;
00719     }
00720   if ((p = strstr (lptw->fontname, " Bold")) != (LPSTR) NULL)
00721     {
00722       lf.lfFaceName[(unsigned int) (p - lptw->fontname)] = '\0';
00723       lf.lfWeight = FW_BOLD;
00724     }
00725   if (lptw->hfont != 0)DeleteFont (lptw->hfont);
00726   lptw->hfont = CreateFontIndirect ((LOGFONT FAR *) & lf);
00727   /* get text size */
00728   SelectFont (hdc, lptw->hfont);
00729   GetTextMetrics (hdc, (TEXTMETRIC FAR *) & tm);
00730   lptw->CharSize.y = tm.tmHeight;
00731   lptw->CharSize.x = tm.tmAveCharWidth;
00732   lptw->CharAscent = tm.tmAscent;
00733   if (lptw->bFocus) CreateCaret (lptw->hWndText, 0, lptw->CharSize.x, 2 + lptw->CaretHeight);
00734   ReleaseDC (lptw->hWndText, hdc);
00735   return;
00736 }

Here is the call graph for this function:

EXPORT void WINAPI TextMessage ( void   ) 

Definition at line 95 of file wtext.c.

References TextMessage1().

00096 {
00097   TextMessage1 (0);
00098   return;
00099 }

Here is the call graph for this function:

EXPORT int WINAPI TextPutCh ( LPTW  lptw,
BYTE  ch 
)

Definition at line 414 of file wtext.c.

References tagTW::Attr, tagTW::AttrBuffer, tagTW::CursorFlag, tagTW::CursorPos, n, NewLine(), pos, tagTW::ScreenBuffer, tagTW::ScreenSize, TextPutCh(), TextToCursor(), and UpdateText().

00415 {
00416   int pos;
00417 
00418   switch (ch)
00419     {
00420     case '\r':
00421       lptw->CursorPos.x = 0;
00422       if (lptw->CursorFlag)
00423         TextToCursor (lptw);
00424       break;
00425     case '\n':
00426       NewLine (lptw);
00427       break;
00428     case 7:
00429       MessageBeep (MB_OK);
00430       if (lptw->CursorFlag)
00431         TextToCursor (lptw);
00432       break;
00433     case '\t':
00434       {
00435         int n;
00436         for (n = 8 - (lptw->CursorPos.x % 8); n > 0; n--)
00437           TextPutCh (lptw, ' ');
00438       }
00439       break;
00440     case 0x08:
00441     case 0x7f:
00442       lptw->CursorPos.x--;
00443       if (lptw->CursorPos.x < 0)
00444         {
00445           lptw->CursorPos.x = lptw->ScreenSize.x - 1;
00446           lptw->CursorPos.y--;
00447         }
00448       if (lptw->CursorPos.y < 0)
00449         lptw->CursorPos.y = 0;
00450       break;
00451     default:
00452         
00453       pos = lptw->CursorPos.y * lptw->ScreenSize.x + lptw->CursorPos.x;
00454       lptw->ScreenBuffer[pos] = ch;
00455       lptw->AttrBuffer[pos] = lptw->Attr;
00456       UpdateText (lptw, 1);
00457     }
00458   return ch;
00459 }

Here is the call graph for this function:

EXPORT int WINAPI TextPutS ( LPTW  lptw,
LPSTR  str 
)

Definition at line 933 of file wtext.c.

References TextPutStr().

00934 {
00935   TextPutStr (lptw, str);
00936   return str[strlen (str) - 1];
00937 }

Here is the call graph for this function:

void TextPutStr ( LPTW  lptw,
LPSTR  str 
)

Definition at line 461 of file wtext.c.

References tagTW::Attr, tagTW::AttrBuffer, count, tagTW::CursorPos, n, NewLine(), p, tagTW::ScreenBuffer, tagTW::ScreenSize, TextPutCh(), and UpdateText().

00462 {
00463   BYTE FAR *p, FAR * pa;
00464   int count, limit;
00465   while (*str)
00466     {
00467       p = lptw->ScreenBuffer + lptw->CursorPos.y * lptw->ScreenSize.x + lptw->CursorPos.x;
00468       pa = lptw->AttrBuffer + lptw->CursorPos.y * lptw->ScreenSize.x + lptw->CursorPos.x;
00469       limit = lptw->ScreenSize.x - lptw->CursorPos.x;
00470 
00471       for (count = 0; (count < limit) && *str && (iswprint ((int) str[0]) || *str == '\t'); count++)
00472         {
00473           if (*str == '\t')
00474             {
00475               int n;
00476               for (n = 8 - ((lptw->CursorPos.x + count) % 8); (count < limit) & (n > 0); n--, count++)
00477                 {
00478                   *p++ = ' ';
00479                   *pa++ = lptw->Attr;
00480                 }
00481               str++;
00482               count--;
00483             }
00484           else
00485             {
00486               *p++ = *str++;
00487               *pa++ = lptw->Attr;
00488             }
00489         }
00490       if (count > 0)
00491         {
00492           UpdateText (lptw, count);
00493         }
00494       if (*str == '\n')
00495         {
00496           NewLine (lptw);
00497           str++;
00498         }
00499       else if (*str && !iswprint ((int) str[0]) && *str != '\t')
00500         {
00501           TextPutCh (lptw, *str++);
00502         }
00503     }
00504 }

Here is the call graph for this function:

EXPORT void WINAPI TextScrollReverse ( LPTW  lptw  ) 

Definition at line 1051 of file wtext.c.

References tagTW::AttrBuffer, tagTW::CharSize, tagTW::CursorPos, tagTW::hWndText, len, LimitMark(), tagTW::MarkBegin, tagTW::MarkEnd, NOTEXT, NULL, tagTW::ScreenBuffer, and tagTW::ScreenSize.

01052 {
01053   RECT rect;
01054   int len = lptw->ScreenSize.x * (lptw->ScreenSize.y - 1);
01055   _fmemmove(lptw->ScreenBuffer+lptw->ScreenSize.x, lptw->ScreenBuffer, len);
01056   _fmemset(lptw->ScreenBuffer, ' ', lptw->ScreenSize.x);
01057   _fmemmove(lptw->AttrBuffer+lptw->ScreenSize.x, lptw->AttrBuffer, len);
01058   _fmemset(lptw->AttrBuffer, NOTEXT, lptw->ScreenSize.x);
01059   if (lptw->CursorPos.y)
01060     lptw->CursorPos.y--;
01061   ScrollWindow (lptw->hWndText, 0, +lptw->CharSize.y, NULL, NULL);
01062   GetClientRect (lptw->hWndText, (LPRECT) & rect);
01063   rect.top = lptw->ScreenSize.y * lptw->CharSize.y;
01064   if (rect.top < rect.bottom) InvalidateRect (lptw->hWndText, (LPRECT) & rect, 1);
01065   lptw->MarkBegin.y++;
01066   lptw->MarkEnd.y++;
01067   LimitMark (lptw, &lptw->MarkBegin);
01068   LimitMark (lptw, &lptw->MarkEnd);
01069   UpdateWindow (lptw->hWndText);
01070 }

Here is the call graph for this function:

void TextSelectFont ( LPTW  lptw  ) 

Definition at line 738 of file wtext.c.

References tagTW::fontname, tagTW::fontsize, hdc, tagTW::hWndParent, tagTW::hWndText, int, memset(), NULL, p, and TextMakeFont().

00739 {
00740   LOGFONT lf;
00741   CHOOSEFONT cf;
00742   HDC hdc;
00743   char lpszStyle[LF_FACESIZE];
00744   LPSTR p;
00745   /* Set all structure fields to zero. */
00746   memset (&cf, 0, sizeof (CHOOSEFONT));
00747   memset (&lf, 0, sizeof (LOGFONT));
00748   cf.lStructSize = sizeof (CHOOSEFONT);
00749   cf.hwndOwner = lptw->hWndParent;
00750   strncpy (lf.lfFaceName, lptw->fontname, LF_FACESIZE);
00751   if ((p = strstr (lptw->fontname, " Bold")) != (LPSTR) NULL)
00752     {
00753       strncpy (lpszStyle, p + 1, LF_FACESIZE);
00754       lf.lfFaceName[(unsigned int) (p - lptw->fontname)] = '\0';
00755     }
00756   else if ((p = strstr (lptw->fontname, " Italic")) != (LPSTR) NULL)
00757     {
00758       strncpy (lpszStyle, p + 1, LF_FACESIZE);
00759       lf.lfFaceName[(unsigned int) (p - lptw->fontname)] = '\0';
00760     }
00761   else
00762     strcpy (lpszStyle, "Regular");
00763   cf.lpszStyle = lpszStyle;
00764   hdc = GetDC (lptw->hWndText);
00765   lf.lfHeight = -MulDiv (lptw->fontsize, GetDeviceCaps (hdc, LOGPIXELSY), 72);
00766   ReleaseDC (lptw->hWndText, hdc);
00767   lf.lfPitchAndFamily = FIXED_PITCH;
00768   cf.lpLogFont = &lf;
00769   cf.nFontType = SCREEN_FONTTYPE;
00770   cf.Flags = CF_SCREENFONTS | CF_FIXEDPITCHONLY | CF_INITTOLOGFONTSTRUCT | CF_USESTYLE;
00771   if (ChooseFont (&cf))
00772     {
00773       RECT rect;
00774       strcpy (lptw->fontname, lf.lfFaceName);
00775       lptw->fontsize = cf.iPointSize / 10;
00776       if (cf.nFontType & BOLD_FONTTYPE)
00777         lstrcat (lptw->fontname, " Bold");
00778       if (cf.nFontType & ITALIC_FONTTYPE)
00779         lstrcat (lptw->fontname, " Italic");
00780       TextMakeFont (lptw);
00781       /* force a window update */
00782       GetClientRect (lptw->hWndText, (LPRECT) & rect);
00783       SendMessage (lptw->hWndText, WM_SIZE, SIZE_RESTORED,
00784                MAKELPARAM (rect.right - rect.left, rect.bottom - rect.top));
00785       GetClientRect (lptw->hWndText, (LPRECT) & rect);
00786       InvalidateRect (lptw->hWndText, (LPRECT) & rect, 1);
00787       UpdateWindow (lptw->hWndText);
00788     }
00789 }

Here is the call graph for this function:

EXPORT void WINAPI TextToCursor ( LPTW  lptw  ) 

Definition at line 327 of file wtext.c.

References tagTW::CharSize, tagTW::ClientSize, tagTW::CursorPos, tagTW::hWndText, max, min, NULL, SB_HORZ, SB_VERT, tagTW::ScrollMax, tagTW::ScrollPos, and TRUE.

00328 {
00329   int nXinc = 0;
00330   int nYinc = 0;
00331   int cxCursor;
00332   int cyCursor;
00333   cyCursor = lptw->CursorPos.y * lptw->CharSize.y;
00334   if ((cyCursor + lptw->CharSize.y > lptw->ScrollPos.y + lptw->ClientSize.y)
00335       || (cyCursor < lptw->ScrollPos.y))
00336     {
00337       nYinc = max (0, cyCursor + lptw->CharSize.y - lptw->ClientSize.y) - lptw->ScrollPos.y;
00338       nYinc = min (nYinc, lptw->ScrollMax.y - lptw->ScrollPos.y);
00339     }
00340   cxCursor = lptw->CursorPos.x * lptw->CharSize.x;
00341   if ((cxCursor + lptw->CharSize.x > lptw->ScrollPos.x + lptw->ClientSize.x)
00342       || (cxCursor < lptw->ScrollPos.x))
00343     {
00344       nXinc = max (0, cxCursor + lptw->CharSize.x - lptw->ClientSize.x / 2) - lptw->ScrollPos.x;
00345       nXinc = min (nXinc, lptw->ScrollMax.x - lptw->ScrollPos.x);
00346     }
00347   if (nYinc || nXinc)
00348     {
00349       lptw->ScrollPos.y += nYinc;
00350       lptw->ScrollPos.x += nXinc;
00351       ScrollWindow (lptw->hWndText, -nXinc, -nYinc, NULL, NULL);
00352       SetScrollPos (lptw->hWndText, SB_VERT, lptw->ScrollPos.y, TRUE);
00353 
00354       SetScrollPos (lptw->hWndText, SB_HORZ, lptw->ScrollPos.x, TRUE);
00355       UpdateWindow (lptw->hWndText);
00356     }
00357 }

EXPORT int WINAPI TextWhereX ( LPTW  lptw  ) 

Definition at line 948 of file wtext.c.

References tagTW::CursorPos.

00949 {
00950   return lptw->CursorPos.x;
00951 }

EXPORT int WINAPI TextWhereY ( LPTW  lptw  ) 

Definition at line 953 of file wtext.c.

References tagTW::CursorPos.

00954 {
00955   return lptw->CursorPos.y;
00956 }

void UnSelect ( LPTW  lptw  ) 

Definition at line 1899 of file wtext.c.

References ClearMark(), tagTW::CursorPos, HasAZoneTextSelected(), tagTW::hPopMenu, M_COPY_CLIP, M_EVALSELECTION, M_HELPON, M_OPENSELECTION, M_PRINTSELECTION, and pt.

Referenced by Callback_PRINT().

01900 {
01901         POINT pt;
01902         pt=lptw->CursorPos;
01903 
01904         ClearMark(lptw, pt);
01905         if  ( !HasAZoneTextSelected(lptw) )
01906           {
01907                 /* Zone Selectionnée --> Activation Menus */
01908                 EnableMenuItem(lptw->hPopMenu,M_COPY_CLIP,MF_GRAYED);
01909             EnableMenuItem(lptw->hPopMenu,M_HELPON,MF_GRAYED);
01910                 EnableMenuItem(lptw->hPopMenu,M_PRINTSELECTION,MF_GRAYED);
01911                 EnableMenuItem(lptw->hPopMenu,M_OPENSELECTION,MF_GRAYED);
01912                 EnableMenuItem(lptw->hPopMenu,M_EVALSELECTION,MF_GRAYED);
01913                 /* EnableMenuItem(lptw->hPopMenu,M_CUT,MF_ENABLED); */
01914                 
01915           }
01916 }

Here is the call graph for this function:

Here is the caller graph for this function:

void UpdateMark ( LPTW  lptw,
POINT  pt 
)

Definition at line 652 of file wtext.c.

References DoMark(), FALSE, LimitMark(), tagTW::MarkBegin, tagTW::MarkEnd, tagTW::ScreenSize, and TRUE.

00653 {
00654   int begin, point, end;
00655   LimitMark (lptw, &pt);
00656   begin = lptw->ScreenSize.x * lptw->MarkBegin.y + lptw->MarkBegin.x;
00657   point = lptw->ScreenSize.x * pt.y + pt.x;
00658   end = lptw->ScreenSize.x * lptw->MarkEnd.y + lptw->MarkEnd.x;
00659 
00660   if (begin <= end)
00661     {
00662       /* forward mark */
00663       if (point >= end)
00664         {
00665           /* extend marked area */
00666           DoMark (lptw, lptw->MarkEnd, pt, TRUE);
00667         }
00668       else if (point >= begin)
00669         {
00670           /* retract marked area */
00671           DoMark (lptw, pt, lptw->MarkEnd, FALSE);
00672         }
00673       else
00674         {                       /* retract and reverse */
00675           DoMark (lptw, lptw->MarkBegin, lptw->MarkEnd, FALSE);
00676           DoMark (lptw, pt, lptw->MarkBegin, TRUE);
00677         }
00678     }
00679   else
00680     {
00681       /* reverse mark */
00682       if (point <= end)
00683         {
00684           /* extend marked area */
00685           DoMark (lptw, pt, lptw->MarkEnd, TRUE);
00686         }
00687       else if (point <= begin)
00688         {
00689           /* retract marked area */
00690           DoMark (lptw, lptw->MarkEnd, pt, FALSE);
00691         }
00692       else
00693         {                       /* retract and reverse */
00694           DoMark (lptw, lptw->MarkEnd, lptw->MarkBegin, FALSE);
00695           DoMark (lptw, lptw->MarkBegin, pt, TRUE);
00696         }
00697     }
00698   lptw->MarkEnd.x = pt.x;
00699   lptw->MarkEnd.y = pt.y;
00700 }

Here is the call graph for this function:

void UpdateText ( LPTW  lptw,
int  count 
)

Definition at line 384 of file wtext.c.

References tagTW::CharSize, tagTW::CursorPos, GetIhmTextBackgroundColor(), GetIhmTextColor(), hdc, tagTW::hfont, tagTW::hWndText, NewLine(), tagTW::ScreenBuffer, tagTW::ScreenSize, tagTW::ScrollPos, and TRUE.

00385 {
00386   HDC hdc;
00387         
00388   int xpos, ypos;
00389   xpos = lptw->CursorPos.x * lptw->CharSize.x - lptw->ScrollPos.x;
00390   ypos = lptw->CursorPos.y * lptw->CharSize.y - lptw->ScrollPos.y;
00391   hdc = GetDC (lptw->hWndText);
00392 
00393   SetTextColor (hdc, GetIhmTextColor());
00394   SetBkColor (hdc, GetIhmTextBackgroundColor());
00395 
00396   SelectFont (hdc, lptw->hfont);
00397   TextOut (hdc, xpos, ypos,(LPSTR) (lptw->ScreenBuffer + lptw->CursorPos.y * lptw->ScreenSize.x +  lptw->CursorPos.x), count);
00398   ReleaseDC (lptw->hWndText, hdc);
00399   lptw->CursorPos.x += count;
00400   if (lptw->CursorPos.x >= lptw->ScreenSize.x)  NewLine (lptw);
00401         else
00402         {
00403                 RECT RectZone;
00404 
00405                 RectZone.left=0;
00406                 RectZone.top=ypos;
00407                 RectZone.bottom=ypos+lptw->CharSize.y;
00408                 RectZone.right=xpos+lptw->CharSize.x;
00409 
00410                 InvalidateRect(lptw->hWndText,&RectZone,TRUE);
00411         }
00412 }

Here is the call graph for this function:

void write_scilab_synchro ( char *  line  ) 

Definition at line 1809 of file wtext.c.

References hThreadWrite, NULL, Sync, and WriteTextThread().

Referenced by EvaluateSelection().

01812 {
01813         DWORD IdThreadWrite;
01814                 
01815         InitializeCriticalSection(&Sync);
01816         hThreadWrite=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)WriteTextThread,line,0,(LPDWORD)&IdThreadWrite);
01817         CloseHandle(hThreadWrite);
01818         
01819 }

Here is the call graph for this function:

Here is the caller graph for this function:

void WriteIntoKeyBuffer ( LPTW  lptw,
char *  StringCommand 
)

Definition at line 1949 of file wtext.c.

References count, FALSE, i, tagTW::KeyBuf, tagTW::KeyBufIn, tagTW::KeyBufOut, tagTW::KeyBufSize, TRUE, and WriteInKeyBuf.

01950 {
01951         int lg=0;
01952         int i=0;
01953 
01954         lg=strlen(StringCommand);
01955         WriteInKeyBuf=TRUE;
01956         while(i<lg)
01957                 {
01958                         long count;
01959                         count = lptw->KeyBufIn - lptw->KeyBufOut;
01960                         
01961                         if (count < 0) count = count+lptw->KeyBufSize;
01962                         if (count < (long) (lptw->KeyBufSize-1)) 
01963                         {
01964                                 if (StringCommand[i] == '\t') *lptw->KeyBufIn++ = ' ';
01965                                 else *lptw->KeyBufIn++ = StringCommand[i];
01966                                 if (lptw->KeyBufIn - lptw->KeyBuf >= (signed)lptw->KeyBufSize)
01967                                 lptw->KeyBufIn = lptw->KeyBuf;  /* wrap around */
01968                         }
01969                         i++;    
01970                 }
01971         WriteInKeyBuf=FALSE;
01972 }

BOOL WriteIntoScilab ( LPTW  lptw,
char *  StringCommand 
)

Definition at line 1921 of file wtext.c.

References tagTW::bGetCh, C2F, FALSE, FREE, get_is_reading(), ismenu(), MALLOC, NULL, StoreCommand(), TRUE, and WriteIntoKeyBuffer().

Referenced by Callback_DEMOS().

01922 {
01923         BOOL retour=FALSE;
01924         
01925         if  (( ( C2F (ismenu) () == 1 ) || ( lptw->bGetCh == FALSE ) ) && (!get_is_reading()) )
01926         {
01927                 StoreCommand(StringCommand);
01928         }
01929         else
01930         {
01931                 int lg=0;
01932                 char *CommandLine=NULL;
01933                 
01934                 lg=strlen(StringCommand)+1+1;
01935                 CommandLine=(char*)MALLOC( (lg)*sizeof(char) );
01936 
01937                 sprintf(CommandLine,"%s\n",StringCommand);
01938 
01939                 WriteIntoKeyBuffer(lptw,CommandLine);
01940 
01941                 if (CommandLine) {FREE(CommandLine);CommandLine=NULL;}
01942                 retour=TRUE;
01943         }
01944 
01945         return retour;
01946 }

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD WINAPI WriteTextThread ( LPVOID  lpParam  ) 

Definition at line 1821 of file wtext.c.

References tagTW::bGetCh, C2F, FALSE, GetTextWinScilab(), ismenu(), line, Sync, TEMPOTOUCHE, and write_scilab().

Referenced by write_scilab_synchro().

01822 {
01823         #define TEMPOTOUCHE  1
01824         char *line;
01825         LPTW lptw=GetTextWinScilab();
01826 
01827         line=(char *)lpParam;
01828         
01829         EnterCriticalSection(&Sync);
01830         while ( C2F (ismenu) () == 1 ) {Sleep(TEMPOTOUCHE);}
01831         /* Il n'y a plus rien dans la queue des commandes */
01832         while ( lptw->bGetCh == FALSE ) {Sleep(TEMPOTOUCHE);}
01833                 
01834         /* Nous sommes au prompt */
01835         write_scilab(line);
01836         LeaveCriticalSection(&Sync);
01837         DeleteCriticalSection(&Sync);
01838         return 0;
01839 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

BOOL ConsoleIsMinimized

Definition at line 46 of file wtext.c.

Referenced by sci_raise_window().


Generated on Sun Mar 4 16:00:47 2007 for Scilab [trunk] by  doxygen 1.5.1