// --------------------------------------------------------- // Reset input mode to default input mode when language changed // --------------------------------------------------------- // void CGSPenInputModel::ResetDefaultInputMode() { switch(iInputLanguage) { case ELangPrcChinese: { if (InputMode() != EPinyin) { SetInputMode(EPinyin); } } break; case ELangHongKongChinese: { if (InputMode() != EStroke) { SetInputMode(EStroke); } } break; case ELangTaiwanChinese: { if (InputMode() != EZhuyin) { SetInputMode(EZhuyin); } } break; default: break; } }
void UnpackW(bool fShow, uchar bOffset) { if (cbHeaderBcc == 0) return; if (cwInBuffBcc == IndexInBuff()) return; cwInBuffBcc = IndexInBuff(); if ((fShow == true) && (IndexInBuff() > 60)) sprintf(szLo," прием: %-4u ",IndexInBuff()); if (IndexInBuff() > 2) { InitPop(1); uint j = 0; uchar i; for (i=0; i<IndexInBuff()-2; i++) { if (PopChar0Bcc() == ')') j++; // MonitorString("\n"); MonitorCharDec(j); MonitorString(" ? "); MonitorCharDec(cbHeaderBcc); // MonitorString(" "); MonitorCharDec(i); MonitorString(" + "); MonitorCharDec(bOffset); MonitorString(" ? "); MonitorCharDec(IndexInBuff()); if ((j == cbHeaderBcc) && (i+bOffset == IndexInBuff()) && (InBuff(IndexInBuff()-2) == 0x03)) { SetCountInBuff(i+bOffset); if ((fShow == true) && (IndexInBuff() > 60)) sprintf(szLo," прием: %-4u ",IndexInBuff()); MonitorIn(); InputMode(); mpSerial[ibPort] = SER_POSTINPUT_MASTER; break; } } } }
UI2DView::UI2DView () : DBObject ("Noname 2DView",sizeof (UI2DView)) { char name [DBStringLength]; Widget menuBar, scrolledWindow, radioBox; Widget button; static Pixmap iconPixmap = (Pixmap) NULL, meshPixmap = (Pixmap) NULL; static Pixmap fullPixmap = (Pixmap) NULL, extentPixmap = (Pixmap) NULL; static Pixmap capturePixmap = (Pixmap) NULL, redrawPixmap = (Pixmap) NULL; static Pixmap zoomPixmap = (Pixmap) NULL, panePixmap = (Pixmap) NULL, userPixmap = (Pixmap) NULL; Pixel foreground, background; XWindowAttributes xwa; XSetWindowAttributes xswa; Atom deleteWindowAtom = XmInternAtom(XtDisplay(UITopLevel ()),(char *) "WM_DELETE_WINDOW",FALSE); _UI2DViewLIST.Add (this); sprintf (name,"2DView:%2d",RowID ()); Name (name); Image = (XImage *) NULL; DrawRegion = FullRegion = NULL; MaxVertexNumVAR = 0; PointARR = (XPoint *) NULL; RequiredEXT = (UIDataset ())->Extent (); DShell = XtVaCreatePopupShell ("UI2DView",xmDialogShellWidgetClass,UITopLevel (), XmNkeyboardFocusPolicy, XmPOINTER, XmNtitle, Name (), XmNtransient, false, XmNminWidth, 600, XmNminHeight, 450, NULL); XmAddWMProtocolCallback (DShell,deleteWindowAtom,(XtCallbackProc) _UI2DViewDeleteCBK,(XtPointer) this); MainFormW = XtVaCreateManagedWidget ("UI2DViewForm",xmFormWidgetClass,DShell, XmNdialogStyle, XmDIALOG_WORK_AREA, XmNshadowThickness, 0, XmNwidth, 600, XmNheight, 450, NULL); menuBar = XtVaCreateManagedWidget ("UI2DViewMenuBar",xmRowColumnWidgetClass,MainFormW, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 2, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 2, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 2, XmNorientation, XmHORIZONTAL, XmNrowColumnType, XmWORK_AREA, NULL); XtVaGetValues (MainFormW,XmNforeground, &foreground,XmNbackground, &background,NULL); iconPixmap = iconPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen (UITopLevel()),(char *) "GHAAS2Dview.bmp",foreground,background): iconPixmap; XtVaSetValues (DShell,XmNiconPixmap, iconPixmap,NULL); fullPixmap = fullPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASfull.bmp", foreground,background) : fullPixmap; extentPixmap = extentPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASextent.bmp",foreground,background) : extentPixmap; capturePixmap= capturePixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAAScapture.bmp",foreground,background):capturePixmap; redrawPixmap = redrawPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASredraw.bmp", foreground,background) : redrawPixmap; zoomPixmap = zoomPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASzoom.bmp", foreground,background) : zoomPixmap; panePixmap = panePixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASpane.bmp", foreground,background) : panePixmap; userPixmap = userPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASuser.bmp", foreground,background) : userPixmap; meshPixmap = meshPixmap == (Pixmap) NULL ? XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASmesh.bmp", foreground,background) : meshPixmap; button = XtVaCreateManagedWidget ("UI2DViewRedrawButton",xmPushButtonGadgetClass,menuBar, XmNlabelType, XmPIXMAP, XmNlabelPixmap, redrawPixmap, NULL); XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _UI2DViewRedrawCBK,this); button = XtVaCreateManagedWidget ("UI2DViewFullButton",xmPushButtonGadgetClass,menuBar, XmNlabelType, XmPIXMAP, XmNlabelPixmap, fullPixmap, NULL); XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _UI2DViewFullActivateCBK,this); button = XtVaCreateManagedWidget ("UI2DViewExtentButton",xmPushButtonGadgetClass,menuBar, XmNlabelType, XmPIXMAP, XmNlabelPixmap, extentPixmap, NULL); XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _UI2DViewExtentActivateCBK,this); button = XtVaCreateManagedWidget ("UI2DViewCaptureButton",xmPushButtonGadgetClass,menuBar, XmNlabelType, XmPIXMAP, XmNlabelPixmap, capturePixmap, NULL); radioBox = XtVaCreateManagedWidget ("UI2DViewRadioBox",xmRowColumnWidgetClass,menuBar, XmNorientation, XmHORIZONTAL, XmNpacking, XmPACK_COLUMN, XmNisHomogeneous, true, XmNentryClass, xmToggleButtonGadgetClass, XmNradioBehavior, true, NULL); ZoomToggle = XtVaCreateManagedWidget ("UI2DViewZoomToggle",xmToggleButtonGadgetClass,radioBox, XmNlabelType, XmPIXMAP, XmNlabelPixmap, zoomPixmap, XmNshadowThickness, 0, XmNset, true, NULL); XtAddCallback (ZoomToggle,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewZoomToggleValueCBK,this); PaneToggle = XtVaCreateManagedWidget ("UI2DViewPaneToggle",xmToggleButtonGadgetClass,radioBox, XmNlabelType, XmPIXMAP, XmNlabelPixmap, panePixmap, XmNshadowThickness, 0, NULL); XtAddCallback (PaneToggle,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewPaneToggleValueCBK,this); UserToggle = XtVaCreateWidget ("UI2DViewUserToggle",xmToggleButtonGadgetClass,radioBox, XmNlabelType, XmPIXMAP, XmNlabelPixmap, userPixmap, XmNmappedWhenManaged, false, XmNshadowThickness, 0, NULL); XtAddCallback (UserToggle,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewUserToggleValueCBK,this); if (_UI2DViewUserFunction != (UI2DViewUserFunction) NULL) XtManageChild (UserToggle); MeshOptionW = XtVaCreateManagedWidget ("UI2DViewMeshOption",xmToggleButtonGadgetClass,menuBar, XmNlabelType, XmPIXMAP, XmNlabelPixmap, meshPixmap, XmNshadowThickness, 0, NULL); XtAddCallback (MeshOptionW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewMeshOptionCBK,this); XtVaSetValues (menuBar, XmNmenuHelpWidget, MeshOptionW, NULL); ScaleW = XtVaCreateManagedWidget ("UI2DViewScale",xmScaleWidgetClass,MainFormW, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menuBar, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 2, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 18, XmNorientation, XmVERTICAL, XmNwidth, 16, NULL); XtAddCallback (ScaleW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewScaleValueChangedCBK,this); scrolledWindow = XtVaCreateManagedWidget ("UI2DViewScrolledWindow",xmScrolledWindowWidgetClass,MainFormW, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menuBar, XmNtopOffset, 2, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, ScaleW, XmNleftOffset, 3, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 3, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 3, XmNspacing, 2, NULL); HorScrollBarW = XtVaCreateManagedWidget ("UI2DViewHorScrollBar", xmScrollBarWidgetClass, scrolledWindow, XmNsliderSize, 100, XmNorientation, XmHORIZONTAL, XmNheight, 16, NULL); XtAddCallback (HorScrollBarW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewHorScrollBarValueChangedCBK,this); VerScrollBarW = XtVaCreateManagedWidget ("UI2DViewVerScrollBar", xmScrollBarWidgetClass, scrolledWindow, XmNsliderSize, 100, XmNorientation, XmVERTICAL, XmNwidth, 16, NULL); XtAddCallback (VerScrollBarW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewVerScrollBarValueChangedCBK,this); DrawingAreaW = XtVaCreateManagedWidget ("UI2DViewDrawingArea", xmDrawingAreaWidgetClass, scrolledWindow, XmNuserData, this, XmNbackground, UIColor (UIColorStandard,0), NULL); XtAddCallback (DrawingAreaW,XmNresizeCallback,(XtCallbackProc) _UI2DViewResizeCBK,this); XtAddEventHandler (DrawingAreaW,EnterWindowMask|LeaveWindowMask|PointerMotionMask|ButtonPressMask|ButtonReleaseMask, false,(XtEventHandler) _UI2DViewPointerEHR,this); XmScrolledWindowSetAreas(scrolledWindow,HorScrollBarW,VerScrollBarW,DrawingAreaW); _UI2DViewViewCursor = _UI2DViewViewCursor != (Cursor) NULL ? _UI2DViewViewCursor : XCreateFontCursor (XtDisplay (DrawingAreaW),XC_top_left_arrow), _UI2DViewUserCursor = _UI2DViewUserCursor != (Cursor) NULL ? _UI2DViewUserCursor : XCreateFontCursor (XtDisplay (DrawingAreaW),XC_crosshair); RegenCursor = XCreateFontCursor (XtDisplay (DrawingAreaW),XC_watch); ActiveCursor = xswa.cursor = _UI2DViewViewCursor; XChangeWindowAttributes (XtDisplay (DrawingAreaW), XtWindow (DrawingAreaW), CWCursor, &xswa); XGetWindowAttributes (XtDisplay (DrawingAreaW),XtWindow (DrawingAreaW),&xwa); Background = xwa.backing_pixel; xswa.backing_store = Always; XChangeWindowAttributes (XtDisplay (DrawingAreaW), XtWindow (DrawingAreaW),CWBackingStore,&xswa); InputMode (ZOOM_MODE); Size (); Set (); }
int main(int argc, char *argv[]) { Planning *pt_plan=NULL; int user, i; char FileRead[MAX_LINE][MAX_CHAR_LINE]; char product; char exec_dir[MAX_PATH_LEN]=""; _interactive_call=1; if ((pt_plan = malloc (sizeof(Planning)))==NULL) { printf("Memory Allocation error\n"); exit(1); } get_exec_directory(exec_dir,argv[0]); premia_self_set_global_vars(exec_dir); if( argc==2 ){ ReadInputFile(argv[1],FileRead); InputMode(&user); WellcomeMsg(user); if ((InitErrorMsg()==OK)&&(InitVar()==OK)) { ResetPlanning(pt_plan); product=FChooseProduct(FileRead); i = 0; while (premia_assets[i].name != NULL) { if (product == premia_assets[i].label) { premia_treat_input_file(pt_plan, premia_assets[i].models, premia_assets[i].families, premia_assets[i].pricings, user, FileRead); break; } i++; } if (premia_assets[i].name == NULL) return FAIL; } }else{ InputMode(&user); WellcomeMsg(user); if ((InitErrorMsg()==OK)&&(InitVar()==OK)){ do { ResetPlanning(pt_plan); product = ChooseProduct(); i = 0; while (premia_assets[i].name != NULL) { if (product == premia_assets[i].label) { pt_plan->Action = ChooseAction (product); premia_interactive_menu(pt_plan, premia_assets[i].models, premia_assets[i].families, premia_assets[i].pricings,user); break; } i++; } } while (NextSession(pt_plan,pt_plan->Action,user)==OK); } } (void)ExitVar(); free(pt_plan); return OK; }