Changeset 78 in Sophya


Ignore:
Timestamp:
Feb 23, 1998, 10:00:35 AM (28 years ago)
Author:
ansari
Message:

suite PIConsole Reza 23/02/98

Location:
trunk/SophyaPI/PI
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/piapplgen.h

    r75 r78  
    66#include PICONT_H
    77#include PIMENUBAR_H
     8
     9#include "picons.h"
    810
    911class PIApplicationGen : public PIMsgHandler {
     
    3133        virtual int               PrefYSize() = 0;
    3234
     35        virtual void              RedirectSdtOut(PIConsole* cons) = 0;
     36
    3337protected:
    3438    PIContainer               *topcont;
  • trunk/SophyaPI/PI/piapplx.cc

    r75 r78  
    55
    66
    7 #define DEBUG_APPLX
     7// Pour rediriger stdout
     8#include <unistd.h>
     9#include <fcntl.h>
     10
     11
     12// #define DEBUG_APPLX
    813
    914static Cursor a_curs[3];
     
    153158
    154159
     160/* Call-Back - Fonction privee de ce fichier */
     161static void redirectstdout_callback(XtPointer, int *, XtInputId*);
     162
     163static PIConsole* curconstdout = NULL;
     164
     165static void redirectstdout_callback(XtPointer /*cld*/, int * fd, XtInputId* /*iid*/)
     166{
     167char buff[128];
     168int nr;
     169while ( (nr=read(*fd, buff, 127)) > 0 ) {
     170  buff[nr] = '\0'; curconstdout->AddStr(buff, PIVA_Def, false);
     171  }
     172
     173curconstdout->Refresh();
     174}
     175
     176
     177/* --Methode-- */
     178void PIApplicationX::RedirectSdtOut(PIConsole* cons)
     179{
     180if (!cons) return;
     181if (curconstdout) { curconstdout = cons; return; }
     182curconstdout = cons;
     183
     184int p[2];
     185pipe(p);
     186// Redirection de stdout :
     187close(1);
     188dup(p[1]);
     189close(p[1]);
     190fcntl(p[0], F_SETFL, O_NONBLOCK);
     191
     192XtAddInput(p[0], (XtPointer) XtInputReadMask, redirectstdout_callback, NULL);
     193}
  • trunk/SophyaPI/PI/piapplx.h

    r76 r78  
    88class PIApplicationX : public PIApplicationGen {
    99public:
    10                   PIApplicationX(int sx=200, int sy=30, int narg=0, char *arg[]=NULL);
     10                            PIApplicationX(int sx=200, int sy=30, int narg=0, char *arg[]=NULL);
    1111
    12   virtual         ~PIApplicationX();
     12  virtual                   ~PIApplicationX();
    1313       
    14   virtual void    Run();
    15   virtual void    Stop() { mStop = false; }
     14  virtual void              Run();
     15  virtual void              Stop() { mStop = false; }
    1616
    17   virtual void    SetReady();
    18   virtual void    SetBusy();
    19   virtual void    SetBlocked();
     17  virtual void              SetReady();
     18  virtual void              SetBusy();
     19  virtual void              SetBlocked();
    2020
    21   virtual int     PrefXSize();
    22   virtual int     PrefYSize();
     21  virtual int               PrefXSize();
     22  virtual int               PrefYSize();
     23  virtual void              RedirectSdtOut(PIConsole* cons);
    2324
    24   PIContainer*    MBCont() { return intcont; }
     25  PIContainer*              MBCont() { return intcont; }
    2526protected:
    2627  PIWdg * topwdg;
  • trunk/SophyaPI/PI/picons.cc

    r77 r78  
    88
    99
    10 #define DEBUG_PICONS 1
     10// #define DEBUG_PICONS 1
    1111
    1212//  Le menu qui va servir a changer de fontes, couleurs, ...
     
    6565
    6666ActivateKeyboard();
    67 ActivateButton(1); // Pour permettre la selection
     67// ActivateButton(1);  Pour permettre la selection
    6868ActivateButton(3); // Pour afficher le menu des options (Fontes/couleur)
    6969Manage();
     
    151151mOffL = 0;
    152152if (mScb) {
     153  mScb->SetMinMax(0, NbLines()-1);
    153154  mScb->SetSize(WindNbLines());
    154155  mScb->SetValue(NbLines()-WindNbLines()-1);
     
    225226  }
    226227mOffL = 0;
    227 if (mScb)  mScb->SetValue(NbLines()-WindNbLines()-1);
    228228}
    229229
     
    240240void PIConsole::Keyboard(int key, PIKeyModifier kmod)
    241241{
    242 char c = ' ' ;
    243 if (isprint(key))  c = key;
    244 
    245 //printf("PIConsole::Keyboard: Key= %d (%c) Mod= %d  NCmdL=%d (%d,%d)\n",
    246 //       key, c, (int)kmod, mNCmdL, mCCP, mCLC);
     242
     243
     244#ifdef DEBUG_PICONS
    247245if ( (kmod == PIKM_Alt) ) {
    248246  char buff[128];
     
    300298  }
    301299}
     300#endif
    302301
    303302if (mNCmdL < 1)  return;
     
    305304int k;
    306305bool fgfk = false;
    307 if (kmod == PIKM_Blank) {
     306
     307if (kmod == PIKM_Cntl) {
     308  switch (key) {
     309    case 'A' :
     310    case 'a' :
     311      mCCP = 0;
     312      break;
     313    case 'E' :
     314    case 'e' :
     315      mCCP = mCLC;
     316      break;
     317    case 'K' :
     318    case 'k' :
     319      mCLC = mCCP;
     320      break;
     321    }
     322  }
     323
     324else if (kmod == PIKM_Alt) {
     325  if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller)
     326  }
     327
     328else if (kmod == PIKM_Blank) {
    308329  switch (key) {
    309330    case PIK_Return :   
    310331    case PIK_Enter :
    311332      mCmdStr[mCLC] = '\0';
    312       printf("Process()-Debug- <CR/Enter> CmdStr= %s (L=%d)\n", mCmdStr, strlen(mCmdStr) );
     333//      printf("Process()-Debug- <CR/Enter> CmdStr= %s (L=%d)\n", mCmdStr, strlen(mCmdStr) );
    313334      Send( Msg(), PIMsg_OK, mCmdStr);
    314335      ClrCmd();
     
    345366
    346367
    347 /* --Methode-- */
     368/* --Methode--
    348369void PIConsole::But1Press(int x, int y)
    349370{
    350 printf("PIConsole::But3Press(%d %d ) \n", x, y);
    351 }
     371printf("PIConsole::But1Press(%d %d ) \n", x, y);
     372} */
    352373
    353374/* --Methode-- */
     
    356377opmc->SetMsgParent((PIMsgHandler*)this);
    357378opmc->Show(this, x, y);
     379}
     380
     381/* --Methode-- */
     382void PIConsole::PasteSelection(unsigned int typ, void *pdata, unsigned int l)
     383{
     384if (typ != PICP_string) return;
     385int i;
     386char *pc = (char *)pdata;
     387for(i=0; i<l; i++) CmdAddChar(pc[i]);
     388UpdCmdLine();
    358389}
    359390
  • trunk/SophyaPI/PI/picons.h

    r77 r78  
    3939  virtual void       Resize();
    4040  virtual void       Keyboard(int key, PIKeyModifier kmod);
    41   virtual void       But1Press(int x, int y);
     41//  virtual void       But1Press(int x, int y);
    4242  virtual void       But3Press(int x, int y);
     43  virtual void       PasteSelection(unsigned int typ, void *pdata, unsigned int l);
    4344
    4445          void       DebugPrint(int cont=0);
  • trunk/SophyaPI/PI/pistdwdgx.cc

    r41 r78  
    468468if (min >= max)  max = min+100;
    469469if (mVal < min)  mVal = min;
    470 if (mVal > max)  mVal = max;
     470if (mVal > max-mSz)  mVal = max-mSz;
    471471int n=0;
    472472Arg warg[3];
Note: See TracChangeset for help on using the changeset viewer.