Changeset 14

Show
Ignore:
Timestamp:
07/08/06 18:42:16 (2 years ago)
Author:
jvw
Message:

HEX/ASCII (sector) editor control added

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/sam2/sam2.c

    r1 r14  
    5353   if (TxaExeSwitch('l'))                       // start logfile now ? 
    5454   { 
    55       TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam")); 
     55      TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam"), TRUE); 
    5656   } 
    5757   if ((TxaExeSwitch('?')) ||                   // switch help requested 
  • trunk/sam3/sam3.c

    r1 r14  
    5454   if (TxaExeSwitch('l'))                       // start logfile now ? 
    5555   { 
    56       TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam")); 
     56      TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam"), TRUE); 
    5757   } 
    5858   if ((TxaExeSwitch('?')) ||                   // switch help requested 
  • trunk/sam4/sam4.c

    r1 r14  
    8484   if (TxaExeSwitch('l'))                       // start logfile now ? 
    8585   { 
    86       TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam")); 
     86      TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam"), TRUE); 
    8787   } 
    8888   if ((TxaExeSwitch('?')) ||                   // switch help requested 
  • trunk/sam5/sam5.c

    r1 r14  
    7272   if (TxaExeSwitch('l'))                       // start logfile now ? 
    7373   { 
    74       TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam")); 
     74      TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam"), TRUE); 
    7575   } 
    7676   if ((TxaExeSwitch('?')) ||                   // switch help requested 
  • trunk/sam6/sam6.c

    r1 r14  
    9393   if (TxaExeSwitch('l'))                       // start logfile now ? 
    9494   { 
    95       TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam")); 
     95      TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam"), TRUE); 
    9696   } 
    9797   if (TxaExeSwitch('?'))                       // switch help requested 
  • trunk/sam7/sam7.c

    r1 r14  
    184184   if (TxaExeSwitch('l'))                       // start logfile now ? 
    185185   { 
    186       TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam")); 
     186      TxAppendToLogFile( TxaExeSwitchStr( 'l', NULL, "sam"), TRUE); 
    187187   } 
    188188   if (TxaExeSwitch('?'))                       // switch help requested 
  • trunk/txlib/include/txcon.h

    r13 r14  
    781781#undef  TRCRCD 
    782782#undef  TRDUMP 
     783#undef  TRHEAP 
    783784#undef  TRINIT 
    784785#undef  TREXIT 
     
    956957 
    957958 
     959#define TRHEAP(lev)                                                           \ 
     960                 {                                                            \ 
     961                    if (TxTrLevel >= lev)                                     \ 
     962                    {                                                         \ 
     963                       switch (_heapchk())                                    \ 
     964                       {                                                      \ 
     965                          case _HEAPOK:                                       \ 
     966                          case _HEAPEMPTY:                                    \ 
     967                             TRLEVX(lev,( "Heap is still OK\n"));             \ 
     968                             break;                                           \ 
     969                                                                              \ 
     970                          default:                                            \ 
     971                             TRLEVX(lev,( "Heap corruption!\n"));             \ 
     972                             break;                                           \ 
     973                       }                                                      \ 
     974                    }                                                         \ 
     975                 } 
     976 
     977 
    958978#define TRINIT(lev)                                                           \ 
    959979                    if (TxTrLevel >= lev)                                     \ 
     
    10511071#define TRCRCD(l,a,b,d) 
    10521072#define TRDUMP(lev,l,a,b,o) 
     1073#define TRHEAP(lev) 
    10531074#define TRINIT(lev) if (TxTrLevel >= lev)                                     \ 
    10541075                    { 
     
    12191240( 
    12201241   ULONG               seq,                     // IN    sequence number 
     1242   ULONG               retain,                  // IN    nr of files kept 
    12211243   TXLN                buf                      // IN    filename buffer 
    12221244); 
  • trunk/txlib/include/txlib.h

    r13 r14  
    16251625 
    16261626// Remove ANSI control code from a text-string (in place conversion) 
    1627 char *TxStripAnsiCodes                          // RET  stripped string 
     1627ULONG TxStripAnsiCodes                          // RET   length stripped string 
    16281628( 
    16291629   char               *text                     // INOUT ANSI text to strip 
  • trunk/txlib/include/txwin.h

    r11 r14  
    8484   TXW_BUTTON        = 7,                       // button - push/radio/checkbox 
    8585   TXW_LISTBOX       = 8,                       // simple selection-list 
     86   TXW_HEXEDIT       = 9,                       // Hex (sector) editor 
    8687} TXWCLASS;                                     // end of enum "txwclass" 
    8788 
     
    315316} TXSTLINE;                                     // end of struct "txstatic" 
    316317 
    317 typedef struct txbutton 
     318typedef struct txbutton                         // any button class 
    318319{ 
    319320   BOOL               *checked;                 // button state 
     
    321322} TXBUTTON;                                     // end of struct "txbutton" 
    322323 
    323 typedef struct txlistbox 
     324typedef struct txlistbox                        // listbox, popup/submenu 
    324325{ 
    325326   short               cpos;                    // current position   (cursor) 
     
    334335   TXSELIST           *list;                    // actual selection list data 
    335336} TXLISTBOX;                                    // end of struct "txlistbox" 
     337 
     338 
     339typedef enum txhexedcmd 
     340{ 
     341   TXHE_CB_UPD_DESC,                            // update buffer desc (hex/dec) 
     342   TXHE_CB_INIT_POS,                            // load initial buffers 
     343   TXHE_CB_NEXT_BUF,                            // make 'next' buffer current 
     344   TXHE_CB_PREV_BUF,                            // make 'prev' buffer current 
     345   TXHE_CB_TO_START,                            // to start of object 
     346   TXHE_CB_TO_FINAL,                            // to end of object 
     347   TXHE_CB_GOTOITEM,                            // go to specified item (sn) 
     348   TXHE_CB_FINDDATA,                            // find data, goto found item 
     349   TXHE_CB_FNDAGAIN,                            // find data again, same data 
     350   TXHE_CB_WRITEBUF,                            // write (changed) buffer 
     351} TXHEXEDCMD;                                   // end of enum "txhexedcmd" 
     352 
     353 
     354typedef ULONG (* TXHEXEDIT_CALLBACK)            // Hex editor action callback 
     355( 
     356   ULONG               cmd,                     // IN    action command 
     357   struct txhexedit   *data                     // INOUT hexedit data 
     358); 
     359 
     360 
     361typedef struct txhebuf                          // hex editor data buffer 
     362{ 
     363   BYTE               *data;                    // start of data buffer 
     364   LLONG               start;                   // abs start position (ref) 
     365   ULONG               size;                    // size of buffer    (item) 
     366   TXLN                desc;                    // buffer description  (76) 
     367} TXHEBUF;                                      // end of struct "txhebuf" 
     368 
     369 
     370typedef struct txhexedit                        // hex editor control 
     371{ 
     372   //- note: a negative offset in the buffer means the current item (buffer) 
     373   //-       is NOT at the top of the display, but further down, and part of 
     374   //-       the PREV buffer is also visible. (0 = buffer start at top-left) 
     375 
     376   LONG                posCurBuf;               // offset in buffer, 1st byte 
     377   LONG                posCursor;               // offset in screen, cursor 
     378   USHORT              hexLsb;                  // hex LSB nibble   (0 or 1) 
     379   USHORT              rows;                    // nr of rows shown    (16) 
     380   USHORT              cols;                    // nr of bytes per row (16) 
     381   BOOL                autocols;                // get 8/16/32/cols from width 
     382   BOOL                ascii;                   // cursor in ascii area 
     383   BOOL                decimal;                 // use decimal positions 
     384   TXHEBUF            *prev;                    // buffer BEFORE current one 
     385   TXHEBUF            *curr;                    // current buffer (item) 
     386   TXHEBUF            *next;                    // buffer AFTER  current one 
     387   BYTE               *diff;                    // difference buf (original) 
     388   ULONG               diffSize;                // size of difference buf 
     389   ULONG               currCrc;                 // 32-bit buf CRC (original) 
     390   void               *userdata;                // application user data 
     391   TXHEXEDIT_CALLBACK  actionCallback;          // application action handler 
     392} TXHEXEDIT;                                    // end of struct "txhexedit" 
    336393 
    337394 
     
    363420      TXBUTTON         bu;                      // push- radio or checkbox 
    364421      TXLISTBOX        lb;                      // listbox with selection list 
     422      TXHEXEDIT        he;                      // hex editor control 
    365423   }; 
    366424} TXWINDOW;                                     // end of struct "txwindow" 
     
    409467#define TXStdStatic(    text) "",   TXW_STATIC,     0, NULL, TXWgStatic(text) 
    410468#define TXStdStline(    text) "",   TXW_STLINE,     0, NULL, TXWgStline(text) 
    411 #define TXStdButton(var,text) "",   TXW_BUTTON,     0, NULL, TXWgButton(&(var),text) 
     469#define TXStdButton(var,text) "",   TXW_BUTTON,     0, NULL, TXWgButton(var,text) 
    412470#define TXStdLstBox(v,p,text) text, TXW_LISTBOX,    0, NULL, TXWgListbox((p),0,0,0,0,0,0,0,0,(v)) 
    413471 
     
    492550#define TXVS_CLOSE_BUTTON     0x01000000        // include close button in border 
    493551 
     552// TXHE_ hex editor control styles 
     553#define TXHE_CLOSE_BUTTON     0x01000000        // include close button in border 
     554#define TXHE_WRITE_PROMPT     0x10000000        // prompt before write-back 
     555#define TXHE_TAB_HTOGGLE      0x20000000        // TAB toggles hex/ascii 
     556 
    494557//- often used Dialog frame/child window combinations 
    495 #define TXWS_CANVAS   TXWS_DISABLED    | TXWS_VISIBLE     | TXWS_SAVEBITS | TXWS_SYNCPAINT 
     558#define TXWS_CANVAS   TXWS_DISABLED    | TXWS_VISIBLE      | TXWS_SAVEBITS    \ 
     559                                       | TXWS_SYNCPAINT 
    496560#define TXWS_DIALOG   TXWS_STDWINDOW   | TXWS_FOURBORDERS 
    497 #define TXWS_DFRAME   TXWS_DIALOG      | TXWS_DISABLED    | TXWS_MOVEABLE 
     561#define TXWS_DFRAME   TXWS_DIALOG      | TXWS_DISABLED    | TXWS_MOVEABLE 
    498562#define TXWS_FRAMED   TXWS_CHILDWINDOW | TXWS_FOURBORDERS 
    499 #define TXWS_PBUTTON  TXWS_FRAMED      | TXBS_PUSHBUTTON  | TXWS_FOCUS_PAINT 
    500 #define TXWS_AUTORAD  TXWS_CHILDWINDOW | TXBS_AUTORADIO   | TXWS_FOCUS_PAINT 
    501 #define TXWS_RADIOB   TXWS_CHILDWINDOW | TXBS_RADIOBUTTON | TXWS_FOCUS_PAINT 
    502 #define TXWS_AUTOCHK  TXWS_CHILDWINDOW | TXBS_AUTOCHECK   | TXWS_FOCUS_PAINT 
    503 #define TXWS_CHECKB   TXWS_CHILDWINDOW | TXBS_CHECKBOX    | TXWS_FOCUS_PAINT 
    504 #define TXWS_EFOCUS   TXWS_LEFTJUSTIFY | TXWS_BRACKETSIDE | TXWS_FOCUS_PAINT 
     563#define TXWS_PBUTTON  TXWS_FRAMED      | TXBS_PUSHBUTTON  | TXWS_FOCUS_PAINT 
     564#define TXWS_AUTORAD  TXWS_CHILDWINDOW | TXBS_AUTORADIO    | TXWS_FOCUS_PAINT 
     565#define TXWS_RADIOB   TXWS_CHILDWINDOW | TXBS_RADIOBUTTON | TXWS_FOCUS_PAINT 
     566#define TXWS_AUTOCHK  TXWS_CHILDWINDOW | TXBS_AUTOCHECK    | TXWS_FOCUS_PAINT 
     567#define TXWS_CHECKB   TXWS_CHILDWINDOW | TXBS_CHECKBOX    | TXWS_FOCUS_PAINT 
     568#define TXWS_EFOCUS   TXWS_LEFTJUSTIFY | TXWS_BRACKETSIDE | TXWS_FOCUS_PAINT 
    505569#define TXWS_EF_BASE  TXWS_EFOCUS      | TXES_DLGE_FIELD 
    506 #define TXWS_ENTRYF   TXWS_CHILD_BASE  | TXWS_EF_BASE     | TXWS_SIDEBORDERS 
     570#define TXWS_ENTRYF   TXWS_CHILD_BASE  | TXWS_EF_BASE      | TXWS_SIDEBORDERS 
    507571#define TXWS_ENTRYT   TXWS_ENTRYF      | TXWS_TITLEBORDER 
    508 #define TXWS_ENTRYB   TXWS_CHILDWINDOW | TXWS_EF_BASE     | TXWS_SIDEBORDERS \ 
     572#define TXWS_ENTRYB   TXWS_CHILDWINDOW | TXWS_EF_BASE      | TXWS_SIDEBORDERS \ 
    509573                                       | TXWS_BRACKETSIDE 
    510 #define TXWS_ENTRYBT  TXWS_ENTRYB      | TXWS_TITLEBORDER | TXWS_TF_TEXTONLY 
    511 #define TXWS_OUTPUT   TXWS_CHILD_BASE  | TXWS_DISABLED    | TXWS_LEFTJUSTIFY 
     574#define TXWS_ENTRYBT  TXWS_ENTRYB      | TXWS_TITLEBORDER | TXWS_TF_TEXTONLY 
     575#define TXWS_OUTPUT   TXWS_CHILD_BASE  | TXWS_DISABLED    | TXWS_LEFTJUSTIFY 
    512576#define TXWS_OUTPUTT  TXWS_OUTPUT      | TXWS_TITLEBORDER 
    513577#define TXWS_DROPMENU TXWS_CHILD_BASE  | TXLS_DROP_MENU 
    514578#define TXWS_A_MENU   TXWS_DROPMENU    | TXWS_TITLEBORDER 
    515 #define TXWS_D_DOWN   TXWS_CHILD_BASE  | TXWS_TITLEBORDER | TXLS_DROP_VALUE 
    516 #define TXWS_D_SPIN   TXWS_D_DOWN      | TXWS_BRACKETSIDE | TXWS_SIDEBORDERS \ 
    517                                        | TXLS_SPIN_WRAP   | TXWS_FOCUS_PAINT 
    518 #define TXWS_DSPINB   TXWS_CHILDWINDOW | TXLS_DROP_VALUE  | TXWS_BRACKETSIDE \ 
    519                     | TXWS_SIDEBORDERS | TXLS_SPIN_WRAP   | TXWS_FOCUS_PAINT 
    520 #define TXWS_DSPINBT  TXWS_DSPINB      | TXWS_TITLEBORDER | TXWS_TF_TEXTONLY 
    521  
     579#define TXWS_D_DOWN   TXWS_CHILD_BASE  | TXWS_TITLEBORDER  | TXLS_DROP_VALUE 
     580#define TXWS_D_SPIN   TXWS_D_DOWN      | TXWS_BRACKETSIDE  | TXWS_SIDEBORDERS \ 
     581                                       | TXLS_SPIN_WRAP    | TXWS_FOCUS_PAINT 
     582#define TXWS_DSPINB   TXWS_CHILDWINDOW | TXLS_DROP_VALUE   | TXWS_BRACKETSIDE \ 
     583                    | TXWS_SIDEBORDERS | TXLS_SPIN_WRAP    | TXWS_FOCUS_PAINT 
     584#define TXWS_DSPINBT  TXWS_DSPINB      | TXWS_TITLEBORDER  | TXWS_TF_TEXTONLY 
     585 
     586#define TXWS_HEXECTL  TXWS_CHILDWINDOW | TXHE_TAB_HTOGGLE 
     587#define TXWS_HEXEDIT  TXWS_HEXECTL     | TXHE_CLOSE_BUTTON | TXWS_FOURBORDERS 
    522588 
    523589// TXWM_COMMAND msg source codes 
     
    669735#define TXLN_ENTER                   5 
    670736 
     737// Hex edit tandard dialog flags 
     738#define TXHE_MOVEABLE                0x2000 
    671739 
    672740// Scroll-buffer related color conversions 
     
    9631031   cMLEntTextStand,                             // Multi-line entry field text 
    9641032   cMLEntTextFocus, 
     1033   cHexEdCurByteChg,                            // Hex Editor control 
     1034   cHexEdCursorByte, 
     1035   cHexEdHexByteStd, 
     1036   cHexEdHexByteChg, 
     1037   cHexEdAscByteStd, 
     1038   cHexEdAscBracket, 
     1039   cHexEdRelPosPrev, 
     1040   cHexEdRelPosCurr, 
     1041   cHexEdRelPosNext, 
     1042   cHexEdAbsBytePos, 
     1043   cHexEdAbsByteCur, 
     1044   cHexEdRelCursorP, 
     1045   cHexEdButtonText, 
     1046   cHexEdButBracket, 
     1047   cHexEdByteNumber, 
     1048   cHexEdItemSnText, 
     1049   cHexEdItemHlight, 
     1050   cHexEdModifyText, 
    9651051   cNrOfSchemeColors 
    9661052} TXW_WINCOLORS;                                // end of enum "txw_wincolors" 
     
    10231109#define  TX_Red_on_White       (TXwCnW + TXwCNR) 
    10241110#define  TX_Magenta_on_White   (TXwCnW + TXwCNM) 
     1111#define  TX_Brown_on_White     (TXwCnW + TXwCNY) 
    10251112#define  TX_Yellow_on_White    (TXwCnW + TXwCBY) 
    10261113#define  TX_Grey_on_White      (TXwCnW + TXwCBZ) 
     
    10431130#define  TX_Black_on_Magenta   (TXwCnM + TXwCNZ) 
    10441131#define  TX_White_on_Magenta   (TXwCnM + TXwCNW) 
     1132#define  TX_Lcyan_on_Magenta   (TXwCnM + TXwCBC) 
    10451133#define  TX_Lwhite_on_Magenta  (TXwCnM + TXwCBW) 
    10461134#define  TX_Magenta_on_Magenta (TXwCnM + TXwCNM) 
     
    20372125); 
    20382126 
    2039 /*======== Help related functions, TXWHELP.C ================================*/ 
     2127/*======== Help related functions, TXWHELP.C ================================                    */ 
    20402128 
    20412129#define TXHELPITEM(nr,title) \ 
     
    20642152); 
    20652153 
     2154/*======== Hex Editor standard dialog, TXWHEXED.C ===========================*/ 
     2155 
     2156// Initialize the Hex-editor dialog/control data structures 
     2157// To be called by CUSTOM hex-editor control users (not standard dialog) 
     2158BOOL txwInitHexeditDialogs 
     2159( 
     2160   void 
     2161); 
     2162 
     2163// Display standard Hex editor dialog 
     2164ULONG txwHexEditor 
     2165( 
     2166   TXWHANDLE           parent,                  // IN    parent window 
     2167   TXWHANDLE           owner,                   // IN    owner  window 
     2168   TXHEXEDIT          *hedat,                   // IN    hex edit data 
     2169   char               *title,                   // IN    title for the dialog 
     2170   ULONG               helpid,                  // IN    help on message 
     2171   ULONG               flags                    // IN    specification flags 
     2172); 
     2173 
    20662174/*======== Window drawing functions, TXWDRAW.C ==============================*/ 
    20672175 
     
    20942202); 
    20952203 
     2204#define txwStringAt(r,c,s,a) txwDrawCharStrCol(hwnd,r,c,s,a) 
    20962205// Draw a character-string at position in specified color, using clip-rect 
    20972206void txwDrawCharStrCol 
  • trunk/txlib/makefile.mif

    r1 r14  
    137137 txwdraw.obj  txwhelp.obj  txwikey.obj  txwind.obj   txwutil.obj  & 
    138138 txwprint.obj txwproc.obj  txwstdlg.obj txwidget.obj txselist.obj & 
    139  txwmsg.obj   txwehook.obj 
     139 txwmsg.obj   txwehook.obj txwhexed.obj 
    140140winspec= & 
    141141 +txwdraw     +txwhelp     +txwikey     +txwind      +txwutil     & 
    142142 +txwprint    +txwproc     +txwstdlg    +txwidget    +txselist    & 
    143  +txwmsg      +txwehook 
     143 +txwmsg      +txwehook    +txwhexed 
    144144!endif 
    145145 
  • trunk/txlib/txcon.c

    r13 r14  
    7575static  char  txc_ansi   = A_ON; 
    7676 
    77 //- logfile cycling and size control 
    78 static  ULONG      log_written = 0;             // bytes written on this file 
     77//- logfile cycling and size control, first size includes closing message ... 
     78static  ULONG      log_written = 50;            // bytes written on this file 
    7979static  ULONG      log_maxsize = 0;             // maximum size per logfile 
    8080static  ULONG      log_seq_num = 0;             // sequence number 0..n 
     
    542542      if ((log_handle != 0) || (txh_clean != NULL)) 
    543543      { 
    544          TxStripAnsiCodes( txm_buff); 
     544         size = TxStripAnsiCodes( txm_buff);    // update size as well! 
    545545         for (hinfo = txh_clean; hinfo != NULL; hinfo = hinfo->next) 
    546546         { 
     
    564564               TXLN    fname; 
    565565 
    566                log_written = 0;                 // avoid recursive cycling 
     566               log_written = size + 150;        // start size new logfile 
     567 
    567568               fprintf( log_handle, "\nClosing logfile at size limit\n"); 
    568569 
     
    570571               if (log_seq_num >= log_retain)   // need to delete one 
    571572               { 
    572                   TxBuildLogName( log_seq_num - log_retain, fname); 
     573                  TxBuildLogName( log_seq_num - log_retain, 
     574                                  log_retain, fname); 
    573575                  remove( fname);               // delete a logfile (cycle) 
    574576               } 
    575                TxBuildLogName( (log_retain) ? ++log_seq_num : 0, fname); 
     577               TxBuildLogName( (log_retain) ? ++log_seq_num : 0, 
     578                                log_retain, fname); 
    576579               TxAppendToLogFile( fname, FALSE); // open next logfile, quiet 
    577580               log_handle  = TxQueryLogFile( &log7bit, &logreopen); 
    578                fprintf( log_handle, "Start next logfile: '%s'\n", fname); 
     581               fprintf( log_handle, "Start logfile nr %lu : '%s'\n", 
     582                        log_seq_num, fname); 
    579583            } 
    580584            else 
     
    603607// Remove ANSI control code from a text-string (in place conversion) 
    604608/*****************************************************************************/ 
    605 char *TxStripAnsiCodes                          // RET  stripped string 
    606 ( 
     609ULONG TxStripAnsiCodes                          // RET   length stripped string 
     610(                                               //       corrected for CR/LF 
    607611   char               *text                     // INOUT ANSI text to strip 
    608612) 
     
    610614   char               *rd = text;               // read-pointer in string 
    611615   char               *wr = text;               // write pointer 
     616   ULONG               ls = 0;                  // length stripped string 
    612617 
    613618   while (*rd) 
     
    624629      { 
    625630         *(wr++) = *rd;                         // copy the character 
     631 
     632         #if !defined(LINUX) 
     633         if (*rd == '\n')                       // when end of line 
     634         { 
     635            ls++;                               // correct for CR/LF char 
     636         } 
     637         ls++;                                  // count for length 
     638         #endif 
    626639      } 
    627640      rd++; 
    628641   } 
    629642   *wr = '\0';                                  // terminate stripped string 
    630    return( text); 
     643   return( ls); 
    631644}                                               // end 'TxStripAnsiCodes' 
    632645/*---------------------------------------------------------------------------*/ 
  • trunk/txlib/txlogfil.c

    r13 r14  
    181181( 
    182182   ULONG               seq,                     // IN    sequence number 
     183   ULONG               retain,                  // IN    nr of files kept 
    183184   TXLN                buf                      // IN    filename buffer 
    184185) 
     
    193194   else 
    194195   { 
     196      if ((seq >= 100) && (retain < 100))       // OK to use modulo seq ? 
     197      { 
     198         seq %= 100;                            // reduce to two digits, to 
     199      }                                         // limit extension to three 
    195200      sprintf( ext, "l%02lu", seq); 
    196201   } 
  • trunk/txlib/txparse.c

    r13 r14  
    249249 
    250250/*****************************************************************************/ 
    251 // Get option value num/string, with bytes/kilo/mega/giga modifier and default 
    252 /*****************************************************************************/ 
    253 ULONG TxaOptBkmg                                // RET   number value in bytes 
    254 ( 
    255    TXHANDLE            txh,                     // IN    TXA handle 
    256    char                option,                  // IN    option character 
    257    ULONG               def,                     // IN    default value 
    258    BYTE                mod                      // IN    b,kb,mb,gb modifier 
    259 ) 
    260 { 
    261    ULONG               rc = 0;                  // function return 
    262    BYTE                unit = TXA_DFUNIT; 
    263    TXA_OPTION         *opt;                     // option pointer 
    264  
    265    ENTER(); 
    266    TRACES(("Option: '%c' default: %8.8lx mod:%2.2hx = '%c'\n", 
    267             option, def, mod, mod)); 
    268  
    269    if ((opt = TxaOptValue( option)) != NULL)    // get the option details 
    270    { 
    271       switch (opt->type) 
    272       { 
    273          case TXA_STRING: 
    274             rc   = TxaParseNumber( opt->value.string, TX_RADIX_STD_CLASS, &unit); 
    275          case TXA_NO_VAL: 
    276             rc   = def; 
    277             break; 
    278  
    279          default:                               // convert, default is MiB! 
    280             rc   = opt->value.number; 
    281             unit = opt->unit; 
    282             break; 
    283       } 
    284    } 
    285    if (unit == TXA_DFUNIT) 
    286    { 
    287       unit = mod; 
    288    } 
    289    switch (tolower(unit)) 
    290    { 
    291       case 'g': 
    292          if (rc >= 4) 
    293          { 
    294             rc = 0xffffffff; 
    295             break; 
    296          } 
    297          else 
    298          { 
    299             rc *= 1024;                         // Giga 
    300          } 
    301       case 'm': rc *= 1024;                     // Mega 
    302       case 'k': rc *= 1024;                     // Kilo 
    303       default:  break;                          // Bytes, OK 
    304    } 
    305    RETURN (rc); 
    306 }                                               // end 'TxaParseBkmgNumber' 
    307 /*---------------------------------------------------------------------------*/ 
    308  
    309  
    310 /*****************************************************************************/ 
    311251// Read one item (option or argument) and store it in the txa element 
    312252/*****************************************************************************/ 
     
    780720   switch (tolower(unit)) 
    781721   { 
    782       case 'g': rc *= 1024;                     // Giga 
     722      case 'g': 
     723      if (rc >= 4) 
     724      { 
     725         rc = 0xffffffff;                       // limit at 4GiB -1 
     726         break; 
     727      } 
     728      else 
     729      { 
     730         rc *= 1024;                            // Giga 
     731      } 
    783732      case 'm': rc *= 1024;                     // Mega 
    784733      case 'k': rc *= 1024;                     // Kilo 
  • trunk/txlib/txstdcmd.c

    r13 r14  
    9797   if (stricmp(c0, "log"      ) == 0) 
    9898   { 
    99       if (TxaOptSet('r')) 
    100       { 
    101          TxSetLogReOpen( TxaOption('r')); 
    102       } 
    103       if (TxaOptSet('m')) 
    104       { 
    105          TxSetLogMaxSize( TxaOptBkmg( 'm', 2047, 'k')); 
    106       } 
    107       if (TxaOptSet('f')) 
    108       { 
    109          TxSetLogRetain( TxaOptNum('f', NULL, 1)); 
    110       } 
    111       TxAppendToLogFile( c1, TRUE); 
     99      if (TxaOption('?')) 
     100      { 
     101         TxPrint( "\nStart or stop logging to a file\n\n" 
     102                  "Usage:  log  [filename] [-r] [-f:ff] [-m:mm]\n\n" 
     103                  "   -f[:ff]      retain ff numbered logfiles when cycling\n" 
     104                  "   -m[:mm]      cycle to next logfile after size mm Kb\n" 
     105                  "   -r           close and reopen log on each line (slow)\n" 
     106                  "   filename     filename with optional path for logfile\n" 
     107                  "                When not specified, logging is STOPPED\n\n"); 
     108      } 
     109      else 
     110      { 
     111         if (TxaOptSet('r')) 
     112         { 
     113            TxSetLogReOpen( TxaOption('r')); 
     114         } 
     115         if (TxaOptSet('m')) 
     116         { 
     117            TxSetLogMaxSize( TxaOptBkmg( 'm', 2047, 'k')); 
     118         } 
     119         if (TxaOptSet('f')) 
     120         { 
     121            TxSetLogRetain( TxaOptNum('f', NULL, 1)); 
     122         } 
     123         TxAppendToLogFile( c1, TRUE); 
     124      } 
    112125   } 
    113126   else if (stricmp(c0, "trace"    ) == 0) 
    114127   { 
    115       if ((c1[0] == '?') || TxaOption('?')) 
     128      if (TxaOption('?')) 
    116129      { 
    117130         TxPrint( "\nSet and check TRACE level, format and destinations\n\n" 
    118                   "Usage: trace  [-r] [-s] [-t] [level | filename]\n\n" 
     131                  "Usage: trace [level | filename] [-r] [-s] [-t] [-d] [-f] [-m]\n\n" 
    119132                  "   -d[:xx]      add xx ms delay for each trace line, slowdown\n" 
    120133                  "   -f[:ff]      retain ff numbered logfiles when cycling\n" 
    121                   "   -m[:mm]      cycle to next logfile after size mm\n" 
     134                  "   -m[:mm]      cycle to next logfile after size mm Kb\n" 
    122135                  "   -r           close and reopen log on each line (slow)\n" 
    123136                  "   -r-          open log just once (this is the default)\n" 
     
    266279      char            *filter[5] = {NULL,NULL,NULL,NULL,NULL}; 
    267280 
    268       if (TxaOption('?') || (c1[0] == '?'))     // explicit help request 
     281      if (TxaOption('?'))                       // explicit help request 
    269282      { 
    270283         TxPrint("\nShow files and/or directories in selectable format\n"); 
  • trunk/txlib/txvers.h

    r13 r14  
    4040// Originally developed for LPTool/DFSee utilities, open-sourced in 2005 
    4141// 
    42 #define TXLIB_V "1.08 12-05-2006" // JvW Logfile maximum size and auto-cycling 
     42#define TXLIB_V "1.09 05-07-2006" // JvW HEXEDIT Home/End if PgUp/PgDn fails 
     43//efine TXLIB_V "1.09 03-07-2006" // JvW HEXEDIT Added Find/find-Again logic 
     44//efine TXLIB_V "1.09 28-06-2006" // JvW HEXEDIT Added highlighted item 0x SN 
     45//efine TXLIB_V "1.09 25-06-2006" // JvW HEXEDIT RC check on all write-backs 
     46//efine TXLIB_V "1.09 22-06-2006" // JvW Fix border repaint overlapping popups 
     47//efine TXLIB_V "1.09 22-06-2006" // JvW HEXEDIT DEL/BACKSPACE and writeback 
     48//efine TXLIB_V "1.09 20-06-2006" // JvW HEXEDIT keyboard & mouse implemented 
     49//efine TXLIB_V "1.09 18-06-2006" // JvW HEXEDIT paint/movement logic implemented 
     50//efine TXLIB_V "1.09 14-06-2006" // JvW Basic HEXEDIT paint logic implemented 
     51//efine TXLIB_V "1.08 14-05-2006" // JvW Accurate logfile size, ext length 3 
     52//efine TXLIB_V "1.08 12-05-2006" // JvW Logfile maximum size and auto-cycling 
    4353//efine TXLIB_V "1.07 04-05-2006" // JvW Avoid (history) popup from other list 
    4454//efine TXLIB_V "1.07 02-05-2006" // JvW Ctrl-D on cmdline, auto NEXT history 
  • trunk/txlib/txwdraw.c

    r11 r14  
    461461         fill.top    = fill.bottom; 
    462462         txwIntersectRect( &clip, &fill, &fill); 
    463          bc.ch = lc[TXLP_BOT]; 
    464          bc.at = TxwSC( cWinBorder_bot + csi_offset); 
    465          if ((style & TXWS_TF_TEXTONLY) == 0)   // unless lines surpressed 
    466          { 
    467             txwScrFillRectangle( &fill, bc); 
    468          } 
    469          if (win->footer && strlen(win->footer)) 
    470          { 
    471             TRACES(( "Window footer: '%s'\n", win->footer)); 
    472             if ((style & TXWS_LEFTJUSTIFY) || (strlen(win->footer) > sx -2)) 
    473             { 
    474                pos = win->border.left; 
    475                if (style & TXWS_SIDEBORDERS) 
    476                { 
    477                   pos++; 
    478                } 
    479             } 
    480             else 
    481             { 
    482                pos = win->border.left + ((sx - strlen(win->footer)) / 2); 
    483             } 
    484             if ( (style & TXWS_BORDERLINES) && (pos > 1) && 
    485                 ((style & TXWS_TF_TEXTONLY) == 0)) // unless lines surpressed 
    486             { 
    487                bc.ch = lc[TXLP_TXL]; 
    488                txwScrDrawCellString( win->border.bottom, 
    489                                      pos -1, 
    490                                      &clip, &bc, (short ) 1, TXSB_COLOR_NORMAL); 
    491  
    492                bc.ch = lc[TXLP_TXR]; 
    493                txwScrDrawCellString( win->border.bottom, 
    494                                      pos +strlen(win->footer), 
    495                                      &clip, &bc, (short ) 1, TXSB_COLOR_NORMAL); 
    496             } 
    497             TRACES(("Write %u length footer to pos %hd\n", strlen(win->footer), pos)); 
    498             txwScrDrawCharStrCol( win->border.bottom, pos, &fill, win->footer, ((act) ? 
    499                            TxwAC( cWinFooterFocus + csi_offset,   win->footerfocus) : 
    500                            TxwAC( cWinFooterStand + csi_offset,   win->footercolor))); 
     463 
     464         if (txwIsRectShowing( hwnd, &fill))    // whole footer visible ? 
     465         { 
     466            bc.ch = lc[TXLP_BOT]; 
     467            bc.at = TxwSC( cWinBorder_bot + csi_offset); 
     468            if ((style & TXWS_TF_TEXTONLY) == 0) // unless lines surpressed 
     469            { 
     470               txwScrFillRectangle( &fill, bc); 
     471            } 
     472            if (win->footer && strlen(win->footer)) 
     473            { 
     474               TRACES(( "Window footer: '%s'\n", win->footer)); 
     475               if ((style & TXWS_LEFTJUSTIFY) || (strlen(win->footer) > sx -2)) 
     476               { 
     477                  pos = win->border.left; 
     478                  if (style & TXWS_SIDEBORDERS) 
     479                  { 
     480                     pos++; 
     481                  } 
     482               } 
     483               else 
     484               { 
     485                  pos = win->border.left + ((sx - strlen(win->footer)) / 2); 
     486               } 
     487               if ( (style & TXWS_BORDERLINES) && (pos > 1) && 
     488                   ((style & TXWS_TF_TEXTONLY) == 0)) // unless lines surpressed 
     489               { 
     490                  bc.ch = lc[TXLP_TXL]; 
     491                  txwScrDrawCellString( win->border.bottom, 
     492                                        pos -1, 
     493                                        &clip, &bc, (short ) 1, TXSB_COLOR_NORMAL); 
     494 
     495                  bc.ch = lc[TXLP_TXR]; 
     496                  txwScrDrawCellString( win->border.bottom, 
     497                                        pos +strlen(win->footer), 
     498                                        &clip, &bc, (short ) 1, TXSB_COLOR_NORMAL); 
     499               } 
     500               TRACES(("Write %u length footer to pos %hd\n", strlen(win->footer), pos)); 
     501               txwScrDrawCharStrCol( win->border.bottom, pos, &fill, win->footer, ((act) ? 
     502                              TxwAC( cWinFooterFocus + csi_offset,   win->footerfocus) : 
     503                              TxwAC( cWinFooterStand + csi_offset,   win->footercolor))); 
     504            } 
    501505         } 
    502506      } 
     
    506510         fill.bottom = fill.top; 
    507511         txwIntersectRect( &clip, &fill, &fill); 
    508          bc.ch = lc[TXLP_TOP]; 
    509          bc.at = TxwSC( cWinBorder_top + csi_offset); 
    510          if ((style & TXWS_TF_TEXTONLY) == 0)   // unless lines surpressed 
    511          { 
    512             txwScrFillRectangle( &fill, bc); 
    513          } 
    514          if (win->title && strlen(win->title)) 
    515          { 
    516             TRACES(( "Window title: '%s'\n", win->title)); 
    517             if ((style & TXWS_LEFTJUSTIFY) || (strlen(win->title) > sx -2)) 
    518             { 
    519                pos = win->border.left; 
    520                if (style & TXWS_SIDEBORDERS) 
    521                { 
    522                   pos++; 
    523                } 
    524             } 
    525             else 
    526             { 
    527                pos = win->border.left + ((sx - strlen(win->title)) / 2); 
    528             } 
    529             if ( (style & TXWS_BORDERLINES) && (pos > 1) && 
    530                 ((style & TXWS_TF_TEXTONLY) == 0)) // unless lines surpressed 
    531             { 
    532                bc.ch = lc[TXLP_TXL]; 
    533                txwScrDrawCellString( win->border.top, 
    534                                      pos -1, 
    535                                      &clip, &bc, (short ) 1, TXSB_COLOR_NORMAL); 
    536  
    537                bc.ch = lc[TXLP_TXR];