Array dbsCallBack_ = create(1, 1) put(dbsCallBack_, -1, 1, 1) DB dbsDB_ = null DBE dbsCnvs_ = null Trigger dbsTrigger_ = null Bitmap dbsLogo_ = null Bitmap dbsIcon_ = null Bitmap dbsIcon2_ = null string doorsHome = getenv "DOORSHOME" string doorsAddins = getenv "DOORSADDINS" if ( doorsAddins == "" ) doorsAddins = doorsHome FileSep_ "lib" FileSep_ "dxl" FileSep_ "addins" const string dbsIconDir_ = doorsAddins FileSep_ "kitchen" FileSep_ "icons" const string dbsLogoFile_ = dbsIconDir_ FileSep_ "kitchenlogo.bmp" const string dbsIconFile_ = dbsIconDir_ FileSep_ "kitchenicon.bmp" const string dbsIconFile2_ = dbsIconDir_ FileSep_ "kitchenicon2.bmp" const string dbsToolTip_ = "Compliments and complaints to the chef: jeremy.dick@oxford.qss.co.uk" int dbsLogoH_ = 0 int dbsLogoW_ = 0 int dbsIconH_ = 0 int dbsIconW_ = 0 void dbsInvoke_(DB db, void closeDB(DB)) { closeDB db } void dbsCloseModule_(DB db) { if ( !null dbsTrigger_ ) delete dbsTrigger_ int cb = (int get(dbsCallBack_, 1, 1)) if ( cb >= 0 && dbsDB_ != null ) dbsInvoke_(dbsDB_, addr_ cb) if ( !null dbsDB_ ) hide dbsDB_ } void dbsCloseModule_(Trigger t) { if ( !null dbsLogo_ && !null dbsCnvs_ ) destroyBitmap(dbsCnvs_, dbsLogo_) if ( !null dbsIcon_ && !null dbsCnvs_ ) destroyBitmap(dbsCnvs_, dbsIcon_) dbsCloseModule_ dbsDB_ } void closeOnModule(DB db, bool visible, void closeDB(DB)) { // add trigger on module close close(db, visible, closeDB) put(dbsCallBack_, closeDB, 1, 1) dbsDB_ = db trigger(module, close, 10, dbsCloseModule_) } void closeOnProject(DB db, bool visible, void closeDB(DB)) { // add trigger on trigger close close(db, visible, closeDB) put(dbsCallBack_, closeDB, 1, 1) dbsDB_ = db trigger(project, close, 10, dbsCloseModule_) } void closeWithTrigger(DB db, bool visible, void closeDB(DB)) { closeOnModule(db, visible, closeDB) } string dbsDoToolTip_(DBE cnvs, string s) { if ( null dbsIcon2_ ) { dbsIcon2_ = loadBitmap(cnvs, dbsIconFile2_, false, dbsIconW_, dbsIconH_) if ( null dbsIcon2_ ) { ack "Failed to load Kitchen icon " dbsIconFile2_ "." return } } drawBitmap(cnvs, dbsIcon2_, (width cnvs) - dbsIconW_, ((height cnvs) - dbsIconH_)/2) return s } void dbsDrawKitchenIcon_(DBE cnvs) { if ( null dbsLogo_ ) { dbsLogo_ = loadBitmap(cnvs, dbsLogoFile_, false, dbsLogoW_, dbsLogoH_) if ( null dbsLogo_ ) { ack "Failed to load Kitchen icon " dbsLogoFile_ "." return } } if ( null dbsIcon_ ) { dbsIcon_ = loadBitmap(cnvs, dbsIconFile_, false, dbsIconW_, dbsIconH_) if ( null dbsIcon_ ) { ack "Failed to load Kitchen icon " dbsIconFile_ "." return } } background(cnvs, logicalPrintPreviewPageColor) drawBitmap(cnvs, dbsLogo_, 0, ((height cnvs) - dbsLogoH_)/2) drawBitmap(cnvs, dbsIcon_, (width cnvs) - dbsIconW_, ((height cnvs) - dbsIconH_)/2) addToolTip(cnvs, 0, 0, (width cnvs), (height cnvs), dbsToolTip_, dbsDoToolTip_) } //////////////////////////////////////////////////////// // Overloading of DB create() DB dbsCreate_DB_(string dbTitle) { create dbTitle } DB create(string dbTitle) { dbsDB_ = dbsCreate_DB_(dbTitle) dbsCnvs_ = canvas(dbsDB_, 220, 40, dbsDrawKitchenIcon_) return dbsDB_ } //////////////////////////////////////////////////////// // Overloading of DB centered() DB dbsCentered_DB_(string dbTitle) { centered dbTitle } DB centered(string dbTitle) { dbsDB_ = dbsCentered_DB_(dbTitle) dbsCnvs_ = canvas(dbsDB_, 220, 60, dbsDrawKitchenIcon_) return dbsDB_ } //////////////////////////////////////////////////////// // Overloading of DB topMost() DB dbsTopMost_DB_(string dbTitle) { topMost dbTitle } DB topMost(string dbTitle) { dbsDB_ = dbsTopMost_DB_(dbTitle) dbsCnvs_ = canvas(dbsDB_, 220, 40, dbsDrawKitchenIcon_) return dbsDB_ } //////////////////////////////////////////////////////// // Overloading of void headerAddColumn(DBE, string, int) void dbsHeaderAddColumn_(DBE cnvs, string s, int w) { headerAddColumn(cnvs, s, w) } void headerAddColumn(DBE cnvs, string s, int w) { // truncate title to sensible length dbsHeaderAddColumn_(cnvs, s[0:100], w) } AddColumn_(cnvs, s[0:100]