56 #define _EDIT_WINDOW_C_IMPLEMENTED_    61 #include "file_help.h"    68 #if 0 // assign to 0 to disable this trace-style debugging ALL of the time    69 #define CALLBACK_TRACKER WBDebugPrint("TEMPORARY - edit_window.c:  %s - callback tracker\n", __FUNCTION__);    71 #define CALLBACK_TRACKER WB_DEBUG_PRINT((DebugLevel_Heavy | DebugSubSystem_EditWindow), "edit_window.c:  %s - callback tracker\n", __FUNCTION__);    74 #define  EDIT_WINDOW_LINE_SPACING 4      76 #define CALLBACK_CHECK_NULL(X) if(X) (X)    77 #define CALLBACK_CHECK_NULL2(X) (X) ? (X)    88 int FWEditWindowEvent(Window wID, XEvent *pEvent);
    89 static void InternalEditWindowDestructor(
WBChildFrame *pC);
    90 static void InternalEditWindowDestroy(
WBEditWindow *pEditWindow);
    94 static void internal_do_char(
WBChildFrame *, XClientMessageEvent *);   
    95 static void internal_scancode(
WBChildFrame *, XClientMessageEvent *);  
   102 static void internal_downarrow(
WBChildFrame *, 
int iACS);              
   103 static void internal_leftarrow(
WBChildFrame *, 
int iACS);              
   104 static void internal_rightarrow(
WBChildFrame *, 
int iACS);             
   112 static void internal_hover_notify(
WBChildFrame *, 
int x, 
int y);       
   122 static void internal_save(
WBChildFrame *, 
const char *szFileName);     
   124 static void internal_mouse_click(
WBChildFrame *, 
int iX, 
int iY,
   125                                  int iButtonMask, 
int iACS);           
   126 static void internal_mouse_dblclick(
WBChildFrame *, 
int iX, 
int iY,
   127                                     int iButtonMask, 
int iACS);        
   128 static void internal_mouse_drag(
WBChildFrame *, 
int iX, 
int iY,
   129                                 int iButtonMask, 
int iACS);            
   130 static void internal_mouse_drop(
WBChildFrame *, 
int iX, 
int iY,
   131                                 int iButtonMask, 
int iACS);            
   132 static void internal_mouse_move(
WBChildFrame *, 
int iX, 
int iY);       
   133 static void internal_scroll_vert(
WBChildFrame *, 
int iMode, 
int iValue);  
   134 static void internal_scroll_horiz(
WBChildFrame *, 
int iMode, 
int iValue); 
   137 static void internal_get_row_col(
WBChildFrame *pC, 
int *piR, 
int *piC);
   146 static void internal_update_status_text(
WBEditWindow *); 
   149 static int PropertyDialogCallback(Window wID, XEvent *pEvent);
   153 static XColor clrFG, clrBG, clrHFG, clrHBG;
   154 static int iInitColorFlag = 0;
   160   internal_do_char,         internal_scancode,     internal_bkspace,        internal_del,
   161   internal_tab,             internal_enter,        internal_properties,
   162   internal_uparrow,         internal_downarrow,
   163   internal_leftarrow,       internal_rightarrow,   internal_home,           internal_end,
   164   internal_pgup,            internal_pgdown,       internal_pgleft,         internal_pgright,
   165   internal_help,            internal_hover_notify, internal_hover_cancel,   internal_is_ins_mode,
   166   internal_toggle_ins_mode, internal_copy_to_cb,   internal_paste_from_cb,  internal_cut_to_cb,
   167   internal_delete_sel,      internal_select_all,   internal_select_none,    internal_save,
   168   internal_get_file_name,   internal_mouse_click,  internal_mouse_dblclick, internal_mouse_drag,
   169   internal_mouse_drop,      internal_mouse_move,   internal_scroll_vert,    internal_scroll_horiz,
   170   internal_mouse_cancel,    internal_get_row_col,  internal_has_selection,  internal_undo,
   171   internal_redo,            internal_can_undo,     internal_can_redo,       internal_is_empty
   217 #define COPY_COLOR_NAME(X,Y,Z) {const char *pX = X(WBGetDefaultDisplay()); if(pX) strncpy(Y,pX,sizeof(Y)); else strncpy(Y,Z,sizeof(Y));}   219 static void InternalCheckEWColorsAndAtoms(
void)
   238     char szFG[16], szBG[16], szHFG[16], szHBG[16]; 
   250     LOAD_COLOR0(
"*Text.foreground",szFG) 
else LOAD_COLOR0(
"*Edit.foreground", szFG)
   251      else LOAD_COLOR(
"*foreground", szFG, 
"#000000");
   252     LOAD_COLOR0(
"*Text.background",szBG) 
else LOAD_COLOR0(
"*Edit.background", szBG)
   253      else LOAD_COLOR(
"*background", szBG, 
"white"); 
   255     LOAD_COLOR(
"selected_bg_color", szABG, 
"#0040FF"); 
   256     LOAD_COLOR(
"selected_fg_color", szAFG, 
"white");   
   258     WB_ERROR_PRINT(
"TEMPORARY:  %s - edit window colors:  FG=%s BG=%s AFG=%s ABG=%s\n", __FUNCTION__,
   259                    szFG, szBG, szAFG, szABG);
   287   InternalCheckEWColorsAndAtoms();
   304   bzero(pRval, 
sizeof(*pRval));
   320                           szFocusMenu, pHandlerArray,
   321                           FWEditWindowEvent, fFlags);
   325     WB_ERROR_PRINT(
"ERROR:  %s - unable to initialize child frame\n", __FUNCTION__);
   350   internal_update_status_text(pRval); 
   360 static void InternalEditWindowDestroy(
WBEditWindow *pEditWindow)
   372   pEditWindow->
ulTag = 0; 
   375 static void InternalEditWindowDestructor(
WBChildFrame *pC)
   381   InternalEditWindowDestroy(pEW);
   383   bzero(pEW, 
sizeof(*pEW)); 
   394     WB_ERROR_PRINT(
"ERROR:  %s - invalid Edit Window pointer %p\n", __FUNCTION__, pEditWindow);
   414     WB_ERROR_PRINT(
"ERROR:  %s - destructor is NULL - pointer will not be free'd\n", __FUNCTION__);
   416     InternalEditWindowDestroy(pEditWindow); 
   456      || !pszFileName || !*pszFileName)
   458     WBDebugPrint(
"TEMPORARY:  bad parameters in %s\n", __FUNCTION__);
   481   if(cbBuf >= 0 && pBuf)
   483     if(cbBuf >= 2 && (
unsigned char)pBuf[0] == 0xff && (
unsigned char)pBuf[1] == 0xfe)
   518     XClientMessageEvent evt;
   520     bzero(&evt, 
sizeof(evt));
   522     evt.type=ClientMessage;
   545   if(!pszFileName || !*pszFileName)
   550   if(!pszFileName || !*pszFileName)
   603 int FWEditWindowEvent(Window wID, XEvent *pEvent)
   621       geom.
x = pEvent->xexpose.x;
   622       geom.
y = pEvent->xexpose.y;
   623       geom.
width = pEvent->xexpose.width;
   624       geom.
height = pEvent->xexpose.height;
   659       if(pEvent->xdestroywindow.window == wID)
   693       else if(pEvent->xclient.message_type == 
aWB_TIMER)
   695         static int iTimerThingy = 0;
   707           if(iTimerThingy >= 0)
   725                       "File Modified", 
"This file has been modified on disk - reload?")
   731                                   "File Modified", 
"file re-load not (yet) implemented");
   737                                    "File Modified", 
"file mod date is OLDER than before - what happened?\n\nDo you want to reload it?")
   785 static void internal_update_status_text(
WBEditWindow *pE) 
   795     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
   800   internal_get_row_col(pC, &iR, &iC);
   808   snprintf(tbuf, 
sizeof(tbuf), 
"Row,Col: %d,%d\tlines: %d  width: %d\t%s\t",
   821     WB_ERROR_PRINT(
"ERROR:  %s - not enough memory to display status\n", __FUNCTION__);
   833     internal_update_status_text(pE);
   845 static void internal_notify_change(
WBChildFrame *pC, 
int bUndo)
   851     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
   858     XClientMessageEvent evt;
   860     bzero(&evt, 
sizeof(evt));
   862     evt.type=ClientMessage;
   868     evt.data.l[0] = bUndo;
   876 static void internal_do_char(
WBChildFrame *pC, XClientMessageEvent *pEvent)
   879 int iKey, iACS, nChar;
   887     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
   894   iKey = pEvent->data.l[0];            
   895   iACS = pEvent->data.l[1];
   896   nChar = pEvent->data.l[2];
   897   pBuf = (
char *)&(pEvent->data.l[3]);
   910     internal_notify_change(pC, 0);
   916     internal_notify_change(pC, 0);
   933 static void internal_scancode(
WBChildFrame *pC, XClientMessageEvent *pEvent)
   942     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
   954 static void internal_bkspace(
WBChildFrame *pC, 
int iACS)
   963     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
   975     internal_notify_change(pC, 0);
   990     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1016         internal_notify_change(pC, 0);
  1023     internal_notify_change(pC, 0);
  1028     internal_notify_change(pC, 0);
  1043     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1057     internal_notify_change(pC, 0);
  1072     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1084     internal_notify_change(pC, 0);
  1097 struct _PROPERTY_DLG_ propdlg;
  1098 static const char szPropertiesDlgBox[]=
  1099   "BEGIN_DIALOG FONT:Variable HEIGHT:200 WIDTH:300 TITLE:\"Document Properties\"\n"  1100   "  CONTROL:Text TITLE:\"Document Properties\" X:30 Y:2 WIDTH:240 HEIGHT:17 VISIBLE HALIGN_TEXT_CENTER VALIGN_TEXT_CENTER\n"  1101   "  CONTROL:CheckButton ID:1001 TITLE:\"Use Hard _Tabs\" X:40 Y:38 WIDTH:80 HEIGHT:15 VISIBLE\n"  1102   "  CONTROL:Text TITLE:\"Line ending:\" X:10 Y:51 WIDTH:60 HEIGHT:17 VISIBLE HALIGN_TEXT_RIGHT VALIGN_TEXT_CENTER NOBORDER\n"  1103   "  CONTROL:FirstRadioButton ID:1002 TITLE:\"_LF\" X:70 Y:52 WIDTH:40 HEIGHT:15 VISIBLE HALIGN_TEXT_LEFT VALIGN_TEXT_CENTER CHECKED\n"  1104   "  CONTROL:RadioButton ID:1003 TITLE:\"C_R\" X:110 Y:52 WIDTH:40 HEIGHT:15 HALIGN_TEXT_LEFT VALIGN_TEXT_CENTER VISIBLE\n"  1105   "  CONTROL:RadioButton ID:1004 TITLE:\"_CR+LF\" X:150 Y:52 WIDTH:40 HEIGHT:15 HALIGN_TEXT_LEFT VALIGN_TEXT_CENTER VISIBLE\n"  1106   "  CONTROL:DefPushButton ID:IDOK TITLE:Sa_ve X:80 Y:178 WIDTH:40 HEIGHT:18 VISIBLE\n"  1107   "  CONTROL:CancelButton ID:IDCANCEL TITLE:Cancel X:180 Y:178 WIDTH:40 HEIGHT:18 VISIBLE\n"  1115     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1124   iX = geomParent.
x + geomParent.
border + 50;
  1125   iY = geomParent.
y + geomParent.
border - 50;
  1127   propdlg.pEditWindow = pE; 
  1131                                PropertyDialogCallback,
  1151 static void internal_uparrow(
WBChildFrame *pC, 
int iACS)
  1160     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1189 static void internal_downarrow(
WBChildFrame *pC, 
int iACS)
  1198     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1226 static void internal_leftarrow(
WBChildFrame *pC, 
int iACS)
  1235     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1252     WB_ERROR_PRINT(
"TEMPORARY:  %s - iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
  1265 static void internal_rightarrow(
WBChildFrame *pC, 
int iACS)
  1274     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1291     WB_ERROR_PRINT(
"TEMPORARY:  %s - iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
  1313     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1336     WB_ERROR_PRINT(
"TEMPORARY:  %s - iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
  1358     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1381     WB_ERROR_PRINT(
"TEMPORARY:  %s - iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
  1403     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1428 static void internal_pgdown(
WBChildFrame *pC, 
int iACS)
  1437     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1462 static void internal_pgleft(
WBChildFrame *pC, 
int iACS)
  1471     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1494 static void internal_pgright(
WBChildFrame *pC, 
int iACS)
  1503     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1535     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1542 static void internal_hover_notify(
WBChildFrame *pC, 
int x, 
int y)
  1551     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1567     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1583     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1602     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1612   internal_update_status_text(pE);
  1625     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1656 unsigned long nData = 0;
  1664     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1692       if(iFormat == 8 * 
sizeof(
wchar_t))
  1694         char *pNew = 
WBAlloc(
sizeof(
wchar_t) * (nData + 2));
  1697           bzero(pNew, 
sizeof(
wchar_t) * (nData + 2));
  1698           wcstombs(pNew, (
const wchar_t *)p1, 
sizeof(
wchar_t) * (nData + 2));
  1708         WB_ERROR_PRINT(
"TEMPORARY - %s - clipboard format %d, can't 'PASTE'\n", __FUNCTION__, iFormat);
  1722         internal_notify_change(pC, 0);
  1727         internal_notify_change(pC, 0);
  1747     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1769       internal_notify_change(pC, 0);
  1785     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1798     internal_notify_change(pC, 0);
  1814     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1823   WB_ERROR_PRINT(
"TEMPORARY:  %s - selecting %d,%d,%d,%d\n", __FUNCTION__,
  1847     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1857 static void internal_save(
WBChildFrame *pC, 
const char *szFileName)
  1866     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1883     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1891 static void internal_mouse_click(
WBChildFrame *pC, 
int iX, 
int iY, 
int iButtonMask, 
int iACS)
  1900     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1910 static void internal_mouse_dblclick(
WBChildFrame *pC, 
int iX, 
int iY, 
int iButtonMask, 
int iACS)
  1919     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1929 static void internal_mouse_drag(
WBChildFrame *pC, 
int iX, 
int iY, 
int iButtonMask, 
int iACS)
  1938     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1948 static void internal_mouse_drop(
WBChildFrame *pC, 
int iX, 
int iY, 
int iButtonMask, 
int iACS)
  1957     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1967 static void internal_mouse_move(
WBChildFrame *pC, 
int iX, 
int iY)
  1976     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  1986 static void internal_scroll_vert(
WBChildFrame *pC, 
int iMode, 
int iValue)
  1994     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  2000                  "%s %d - iMode=%d, iValue=%d\n", __FUNCTION__, __LINE__, iMode, iValue);
  2013       if(iValue == rctView.
top) 
  2018       ptScroll.
x = rctView.
left;
  2019       ptScroll.
y = iValue;
  2043 static void internal_scroll_horiz(
WBChildFrame *pC, 
int iMode, 
int iValue)
  2052     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  2058                  "%s %d - iMode=%d, iValue=%d\n", __FUNCTION__, __LINE__, iMode, iValue);
  2071       if(iValue == rctView.
left) 
  2076       ptScroll.
x = iValue;
  2077       ptScroll.
y = rctView.
top;
  2109     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  2118 static void internal_get_row_col(
WBChildFrame *pC, 
int *piR, 
int *piC)
  2127     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  2152     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  2184     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  2201     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  2218     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  2235     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  2253     WB_ERROR_PRINT(
"ERROR:  %s - WBChildFrame and/or WBEditWindow not valid, %p\n", __FUNCTION__, pE);
  2273 static int PropertyDialogCallback(Window wID, XEvent *pEvent)
  2279   if(pEvent->type == ClientMessage && pEvent->xclient.message_type == 
aDIALOG_INIT)
  2283       WB_ERROR_PRINT(
"%s - no WBDialogWindow structure in DIALOG_INIT for %d (%08xH) %p %08xH %08xH\n", __FUNCTION__,
  2316     WB_WARN_PRINT(
"MessageBoxCallback - no WBDialogWindow structure\n");
  2320   if(pEvent->type == ClientMessage && pEvent->xclient.message_type == 
aCONTROL_NOTIFY)
  2322     WB_DEBUG_PRINT(DebugLevel_Light | DebugSubSystem_Event | DebugSubSystem_Dialog,
  2323                    "%s - MessageBox ClientMessage CONTROL_NOTIFY\n", __FUNCTION__);
  2325     switch(pEvent->xclient.data.l[1]) 
  2339         WB_WARN_PRINT(
"%s - MessageBox ClientMessage CONTROL_NOTIFY client id=%lx\n",
  2340                       __FUNCTION__, pEvent->xclient.data.l[1]);
 const char * CHGetHighlightForegroundColor(Display *pDisplay)
returns highlight foreground color
 
Window wID
Window id for the frame window.
 
WBWinEvent pUserCallback
message callback function pointer (can be NULL)
 
char *(* get_sel_text)(const TEXT_OBJECT *pThis, const WB_RECT *pRct)
get the current selection rectangle as WB_RECT
 
void(* begin_mouse_drag)(TEXT_OBJECT *pThis)
Begin a mouse 'drag' operation.
 
void(* do_expose)(TEXT_OBJECT *pThis, Display *pDisplay, Window wID, WBGC gc, const WB_GEOM *pPaintGeom, const WB_GEOM *pViewGeom, WB_FONTC pFont)
Member function to properly render the text in a window (Expose event)
 
int WBEditWindowLoadFile(WBEditWindow *pEditWindow, const char *pszFileName)
Open an existing file and read its contents into the Edit Window, storing the file name for later ref...
 
'window helper' main header file for the X11workbench Toolkit API
 
WBChildFrame childframe
elements common to a 'child frame' (derived object)
 
void(* page_up)(TEXT_OBJECT *pThis)
Move the current cursor position up one page.
 
int FWInitChildFrame(WBChildFrame *pChildFrame, WBFrameWindow *pOwner, WB_FONTC pFont, const char *szFocusMenu, const WBFWMenuHandler *pHandlerArray, WBWinEvent pUserCallback, int fFlags)
Initialize a child frame (assumed to be a base 'class' for the window)
 
void(* mouse_click)(TEXT_OBJECT *pThis, int iMouseXDelta, int iMouseYDelta, int iType, int iACS)
Translate mouse cursor position into actual row/column. This function is irrelevant if the expose met...
 
#define WB_DEBUG_PRINT(L,...)
Preferred method of implementing conditional debug output.
 
void * WBGetWindowData(Window wID, int iIndex)
Gets the data associated with this window and the specified index.
 
unsigned int width
the 'width' value of the extent.
 
int WBFontAscent(WB_FONTC pFont0)
Get the maximum character ascent from a WB_FONT.
 
Utilities for copying and drawing text, determining text extents, and so on.
 
WBEditWindow * WBCreateEditWindow(WBFrameWindow *pOwner, WB_FONT pFont, const char *szFocusMenu, const WBFWMenuHandler *pHandlerArray, int fFlags)
Create an Edit Window.
 
int x
the 'x' value of the point. can be negative.
 
int(* get_insmode)(const TEXT_OBJECT *pThis)
Get the current insert mode for the object.
 
OVERWRITE mode, character inserted on top of character to the right of the cursor (if any),...
 
int WBFontAvgCharWidth(WB_FONTC pFont0)
Get the average character width for a font.
 
Icon - white question mark in green triangle.
 
void(* set_insmode)(TEXT_OBJECT *pThis, int iInsMode)
Set the current insert mode for the object.
 
WBWinEvent pUserCallback
user callback function to receive notifications and unhandled messages
 
structure for managing menu callbacks
 
void(* del_select)(TEXT_OBJECT *pThis)
Delete the current selection assigned via 'set_select'.
 
int FWGetChildFrameIndex(WBFrameWindow *pFW, WBChildFrame *pCont)
Sets the focus to a specific contained window using its tab order index.
 
char * szFileName
malloc'd name of file associated with this edit window (NULL if none)
 
int WBShowModal(Window wID, int bMenuSplashFlag)
Shows a 'modal' window by processing events until the window closes.
 
void(* set_text)(TEXT_OBJECT *pThis, const char *szText, unsigned long cbLen)
Call this function to re-assign all text in the control.
 
Edit Window API functions.
 
void WBGetWindowGeom0(Window wID, WB_GEOM *pGeom)
Returns the ABSOLUTE window geometry relative to the screen.
 
Window wID
window identifier for the 'Child Frame' window. may contain 'None' while being destroyed
 
void(* get_view)(const TEXT_OBJECT *pThis, WB_RECT *pRct)
Get the current viewport (in characters). The return value is not relevant if the expose method has n...
 
static __inline__ void WBInitializeInPlaceTextObject(TEXT_OBJECT *pTextObject, Window wIDOwner)
initialize an 'in-place' TEXT_OBJECT structure
 
unsigned long long WBGetFileModDateTime(const char *szFileName)
Obtain the 'time_t' value for a file's modification date/time (unix time, seconds since the epoch)
 
void(* set_select)(TEXT_OBJECT *pThis, const WB_RECT *pRct)
Set the current selection rectangle as WB_RECT.
 
int(* get_col)(const TEXT_OBJECT *pThis)
Get the current column cursor for the object.
 
void WBDebugDump(const char *szTitle, void *pData, int cbData)
conditionally dumps binary data to debug message output
 
#define CHILD_FRAME_UI_TAG
TAG for the WBChildFrameUI structure.
 
Button Bits - Yes button plus No button.
 
int WBTextObjectCalculateLineHeight(int iAscent, int iDescent)
Calculate the correct per-line height (in pixels) for a specified font ascent and descent.
 
void(* end_highlight)(TEXT_OBJECT *pThis)
End a highlight block.
 
static __inline__ Display * WBGetDefaultDisplay(void)
Returns the default Display.
 
internal wrapper struct for X11 'geometry' definition
 
'configuration helper' main header file for the X11 Work Bench Toolkit API
 
void FWChildFrameStatusChanged(WBChildFrame *pChildFrame)
Notify Child Frame to update status text in Frame Window.
 
Atom aRECALC_LAYOUT
notify window that it should re-calculate things like scrollbars and viewports
 
void(* get_select)(const TEXT_OBJECT *pThis, WB_RECT *pRct)
Get the current selection rectangle as WB_RECT.
 
void(* page_right)(TEXT_OBJECT *pThis)
Move the current cursor position right one page.
 
unsigned int ulTag
'Tag' identifying this structure as a WBEditWindow
 
Atom aDIALOG_INIT
DIALOG_INIT ClientMessage, sent to dialog window callback on frame create.
 
void(* page_down)(TEXT_OBJECT *pThis)
Move the current cursor position down one page.
 
int(* get_rows)(const TEXT_OBJECT *pThis)
Call this function to obtain the total number of rows for display purposes.
 
int WBSetForeground(WBGC hGC, unsigned long foreground)
Assign foreground color, a wrapper for XSetForeground()
 
int WBSetClipboardData(Display *pDisplay, Atom aType, int iFormat, const void *pData, unsigned long nData)
Get clipboard data of requested type.
 
void(* set_col)(TEXT_OBJECT *pThis, int iCol)
Set the current column cursor for the object.
 
WBDialogWindow * DLGCreateDialogWindow(Window wIDOwner, const char *szTitle, const char *szDialogResource, int iX, int iY, int iWidth, int iHeight, WBWinEvent pUserCallback, int iFlags, void *pUserData)
create a dialog window using a text resource
 
#define COPY_COLOR_NAME(X, Y, Z)
macro to get a color name or use default if it does not exist in settings
 
Atom aEW_EDIT_CHANGE
'Edit Change' notification to user-callback, sent via ClientMessage event
 
Structure identifying a dialog (frame) window.
 
void DeleteTimer(Display *pDisplay, Window wID, long lID)
Deletes an existing timer's resources.
 
int WBCheckFileModDateTime(const char *szFileName, unsigned long long tVal)
Compare a 64-bit unsigned integer value against a file's modification date/time (unix time,...
 
void FWChildFrameRecalcLayout(WBChildFrame *pChildFrame)
Child frame notification callback (called by frame window)
 
#define DIALOG_WINDOW_TAG
 
Structure that defines an Edit Window.
 
void(* cursor_home)(TEXT_OBJECT *pThis)
Move the cursor 'home' (left or BOL)
 
void WBEditWindowRegisterCallback(WBEditWindow *pEditWindow, WBWinEvent pUserCallback)
Clear the contents in the Edit Window, and NULL the stored file name.
 
static __inline__ WBChildFrame * FWGetChildFrameStruct(Window wID)
Obtain the associated WBChildFrame structure pointer for a Window ID.
 
WB_POINT origin
viewport 'origin' in 'client units' (such as chars and lines) - determines scroll behavior
 
WB_EXTENT extent
viewport 'extent' in 'client units' (such as chars and lines) - determines scroll behavior
 
const char * CHGetTextColor(Display *pDisplay)
returns text color
 
size_t WBReadFileIntoBuffer(const char *szFileName, char **ppBuf)
read a file's contents into a buffer, returning the length of the buffer
 
void * WBAlloc(int nSize)
High performance memory sub-allocator 'allocate'.
 
void(* cursor_right)(TEXT_OBJECT *pThis)
Move the current cursor position right one column.
 
void(* set_view_orig)(TEXT_OBJECT *pThis, const WB_POINT *pOrig)
Set the current viewport (in characters). Only 'left' and 'top' are relevant if the expose method has...
 
char * szStatusText
Status text ('WBAlloc'd) to display when this child frame window has the input focus....
 
int(* get_row)(const TEXT_OBJECT *pThis)
Get the current row cursor for the object.
 
const char * CHGetHighlightBackgroundColor(Display *pDisplay)
returns highlight background color
 
void(* cursor_up)(TEXT_OBJECT *pThis)
Move the current cursor position up one line.
 
#define WB_ERROR_PRINT(...)
Preferred method of implementing an 'error level' debug message for all subsystems.
 
int iRowHeight
cached 'row height' (height of line including interline spacing)
 
int(* has_select)(const TEXT_OBJECT *pThis)
Returns a non-zero value if there is currently a 'selection'.
 
void WBFree(void *pBuf)
High performance memory sub-allocator 'free'.
 
void(* replace_select)(TEXT_OBJECT *pThis, const char *szText, unsigned long cbLen)
Replace the current selection assigned via 'set_select' with new text.
 
#define WB_KEYEVENT_SHIFT
'AltCtrlShift' bit flag for Shift modifier for WBKeyEventProcessKey()
 
void(* set_linefeed)(TEXT_OBJECT *pThis, int iLineFeed)
Set the current linefeed type for the object.
 
int y
the 'y' value of the point. can be negative.
 
WB_GEOM geom
total client-area geometry (excludes scroll bars) in 'pixels'
 
#define EDIT_WINDOW_TAG
TAG for the WBEditWindow structure.
 
INSERT mode, character inserted at cursor.
 
void FWSetChildFrameScrollInfo(WBChildFrame *pChildFrame, int iRow, int iMaxRow, int iCol, int iMaxCol, int iRowHeight, int iColWidth)
Set the X,Y extent for the child frame (notifies everything)
 
void FWDestroyChildFrame(WBChildFrame *pChildFrame)
Destroy an Child Frame.
 
const TEXT_OBJECT_VTABLE * vtable
method function pointers (similar to C++ virtual member functions)
 
void(* destructor)(struct tagWBChildFrame *)
pointer to a 'superclass' destructor. If not NULL, will be called by FWDestroyChildFrame()
 
#define WB_KEYEVENT_ACSMASK
'AltCtrlShift' bit mask for Alt+Ctrl+Shift bits for WBKeyEventProcessKey()
 
void(* scroll_vertical)(TEXT_OBJECT *pThis, int nRows)
Scroll the viewport up/down by the specified number of rows.
 
int(* WBWinEvent)(Window wID, XEvent *pEvent)
event callback function type for window events
 
void(* del_chars)(TEXT_OBJECT *pThis, int nChar)
Delete 'n' characters from the current cursor. Negative deletes BEFORE the cursor....
 
void(* end_mouse_drag)(TEXT_OBJECT *pThis)
End a mouse 'drag' operation.
 
main controlling structure for frame windows
 
internal wrapper struct for 'rectangle' definition
 
int WBFontDescent(WB_FONTC pFont0)
Get the maximum character descent from a WB_FONT.
 
void(* set_row)(TEXT_OBJECT *pThis, int iRow)
Set the current row cursor for the object.
 
Atom aQUERY_CLOSE
query if it's ok to close (and optionally destroy yourself if ok) a window
 
WBFrameWindow * pOwner
a pointer to the WBFrameWindow owner
 
Display * WBGetWindowDisplay(Window wID)
returns the Display associated with a window
 
Atom aCONTROL_NOTIFY
dialog control and child window notification messages
 
void(* cursor_end)(TEXT_OBJECT *pThis)
Move the cursor to 'end' (full doc width or EOL)
 
static __inline__ WBDialogWindow * DLGGetDialogWindowStruct(Window wID)
Returns a pointer to the dialog window's WBDialogWindow structure.
 
Atom aEW_HOVER_NOTIFY
Hover notification to user-callback, sent via ClientMessage event.
 
void(* cursor_bottom)(TEXT_OBJECT *pThis)
Move the cursor to the last line.
 
WBEditWindow * WBEditWindowFromWindowID(Window wID)
Obtain the associated WBEditWindow structure pointer for a Window ID.
 
int iColWidth
cached 'column width' (width of 1 character)
 
void(* ins_chars)(TEXT_OBJECT *pThis, const char *pChar, int nChar)
Insert 'n' characters (including new lines) from the current cursor.
 
const char * CHGetBackgroundColor(Display *pDisplay)
returns background color for non-static elements
 
void(* cursor_left)(TEXT_OBJECT *pThis)
Move the current cursor position left one column.
 
TEXT_OBJECT xTextObject
the 'TEXT_OBJECT' member, that does MOST of the work
 
Window wIDOwner
owner window (cached from paint/expose handling and/or cursor blink)
 
Atom aBUTTON_PRESS
CONTROL_NOTIFY ClientMessage for BUTTON_PRESS event.
 
int WBSetBackground(WBGC hGC, unsigned long background)
Assign background color, a wrapper for XSetBackground()
 
void WBDebugPrint(const char *pFmt,...) __attribute__((format(printf
conditional debug message output
 
Atom aWB_TIMER
timer notifications generated by API
 
unsigned long long llModDateTime
file's mod date/time - see WBGetFileModDateTime()
 
#define WB_KEYEVENT_CTRL
'AltCtrlShift' bit flag for Control modifier for WBKeyEventProcessKey()
 
An allocated structure containing XFontStruct, XFontInfo, and XftFont [as applicable] for a specified...
 
void(* page_left)(TEXT_OBJECT *pThis)
Move the current cursor position left one page.
 
void(* cursor_blink)(TEXT_OBJECT *pThis, int bHasFocus)
Periodic callback to 'blink' the cursor.
 
int CreateTimer(Display *pDisplay, Window wID, unsigned long lInterval, long lID, int iPeriodic)
Creates a one-shot or periodic timer.
 
void WBEndModal(Window wID, int iRval)
End a modal window with a specific return value.
 
char * WBCopyString(const char *pSrc)
A simple utility that returns a WBAlloc() copy of a 0-byte terminated string.
 
int WBEditWindowSaveFile(WBEditWindow *pEditWindow, const char *pszFileName)
Save the contents from the Edit Window to a file, overwriting the file if it already exists.
 
void WBDestroyEditWindow(WBEditWindow *pEditWindow)
Destroy an Edit Window.
 
unsigned int height
the 'height' value of the extent.
 
internal wrapper struct for 'point' definition
 
void * WBGetClipboardData(Display *pDisplay, Atom *paType, int *piFormat, unsigned long *pnData)
Get clipboard data of requested type.
 
void WBEndPaint(Window wID, WBGC gc)
'Paint' helper, frees resources and marks the update region 'valid'
 
internal wrapper struct for GC with local cache
 
Structure that defines a Child Frame within a Frame Window.
 
Atom aRESIZE_NOTIFY
notification of window re-size via ClientMessage
 
void WBEditWindowClear(WBEditWindow *pEditWindow)
Clear the contents in the Edit Window, and NULL the stored file name.
 
static __inline__ void WBDestroyInPlaceTextObject(TEXT_OBJECT *pTextObject)
Destroy a previously initialized 'in-place' TEXT_OBJECT structure.
 
static __inline__ int WBIsValidEditWindow(WBEditWindow *pEditWindow)
Check for valid WBEditWindow pointer.
 
Structure that defines a Child Frame's UI, mainly for a 'superclass'.
 
void(* begin_highlight)(TEXT_OBJECT *pThis)
Begin a highlight block.
 
Window wID
window ID of the dialog (frame) window
 
int(* get_cols)(TEXT_OBJECT *pThis)
Call this function to obtain the estimated column extent of the document.
 
void(* cursor_top)(TEXT_OBJECT *pThis)
Move the cursor to the top line.
 
Atom aSTRING
STRING Atom for the clipboard - uses XA_STRING.
 
#define WB_WARN_PRINT(...)
Preferred method of implementing a 'warning level' debug message for all subsystems.
 
void(* cursor_down)(TEXT_OBJECT *pThis)
Move the current cursor position down one line.
 
struct tagWBChildFrameUI * pUI
pointer to 'WBChildFrameUI' function pointer table (assigned by 'superclass')
 
int DLGMessageBox(int iType, Window wIDOwner, const char *szTitle, const char *szMessage)
Display a modal 'message box' dialog window with a specific title, message, and button combination.
 
Atom aUTF8_STRING
UTF8_STRING Atom for the clipboard.
 
WB_FONT pFont
default font for the window
 
WBGC WBBeginPaintGeom(Window wID, WB_GEOM *pgBounds)
'Paint' helper, creates a WBGC for use in updating the window for a specified rectangular area
 
void(* scroll_horizontal)(TEXT_OBJECT *pThis, int nCols)
Scroll the cursor to the right/left a specified number of columns.