//------------------------------------------------------------------------------ // EditorSupportsKind_Reg //------------------------------------------------------------------------------ ODBoolean EditorSupportsKind_Reg( ODEditor editor, ODType kind, ODSession* session) { ODTypeList* kindsList = kODNULL; _IDL_SEQUENCE_ISOString PartKindList; ODSShort kind_found = FALSE; Environment* ev = somGetGlobalEnvironment(); ODPartHandlerRegistryInt* ODRegistry; ODSShort i; // retrieve PartKind list from Registry // this is a buffer that the Registry allocates and we need to dispose of. ODRegistry = session -> GetRegistry(ev); PartKindList = ODRegistry-> GetPartKindList( ev, editor, 0); // search the PartKind list for matching kind for ( i = 0; i < PartKindList. _length; i++) { if (strcmp(PartKindList. _buffer[i],kind) == 0 ) { // set unique to false if duplicate editor exists in string array kind_found = TRUE; } } return (kind_found); }
calc(Employee *emp) { SOMClass *mgrClass; SOMClass *empClass; Environment *ev; ev = somGetGlobalEnvironment(); //**************************************************** // Use <className>ClassData.classObject to get // pointer to class object // Alternatively, use _Programmer //**************************************************** if (emp->somIsA(ProgrammerClassData.classObject)) { cout << "Programmer salary: " ; cout << (emp->salary(ev) + ( (Programmer *) emp)->overtime(ev)); } //************************************************ // Create a Manager Class Object //************************************************ mgrClass = ManagerNewClass(0,0); if ( emp->somIsA(mgrClass) ) { cout << "Manager salary: " ; cout << (emp->salary(ev) + ((Manager *) emp)->bonus(ev)); } cout << "\n"; }
SOM_Scope void SOMLINK somDefaultInit(Bank *somSelf, somInitCtrl* ctrl) { BankData *somThis; /* set in BeginInitializer */ somInitCtrl globalCtrl; somf_TSet *temp; somBooleanVector myMask; BankMethodDebug("Bank","somDefaultInit"); Bank_BeginInitializer_somDefaultInit; Bank_Init_SOMObject_somDefaultInit(somSelf, ctrl); ev = somGetGlobalEnvironment(); /* allocate space for checking account */ somSelf->_set_check_acct_set(ev, new somf_TSet); temp = somSelf->_get_check_acct_set(ev); temp->somfTSetInitL(ev, 25); /* allocate space for savings account */ somSelf->_set_save_acct_set(ev, new somf_TSet); temp = somSelf->_get_save_acct_set(ev); temp->somfTSetInitL(ev, 25); /* allocate space for checking account */ somSelf->_set_mf_acct_set(ev, new somf_TSet); temp = somSelf->_get_mf_acct_set(ev); temp->somfTSetInitL(ev, 25); }
void ReadBytes(ODFileRefNum file, ODStorageUnitView* view, ODPtr bytes, ODULong* length) { ODSLong savedLength = *length; Environment* ev = somGetGlobalEnvironment (); if (view) // if a prefocused storage unit is passed in *length = StorageUnitViewGetValue(view, ev, *length, bytes); else { // a file ref has been passed in #ifdef _PLATFORM_MACINTOSH_ THROW_IF_ERROR(FSRead(file, (long *)length, bytes)); #endif #ifdef _PLATFORM_WIN32_ DWORD bytesRead; BOOL successful; successful = ReadFile(file, bytes, *length, &bytesRead, NULL); if (!successful) THROW (GetLastError()); *length = bytesRead; #endif // defined(_PLATFORM_WIN32_) } if (savedLength != (ODSLong)*length) THROW(kODErrReadErr); }
//------------------------------------------------------------------------------ // ContentValueTypes //------------------------------------------------------------------------------ void ContentValueTypes(ODStorageUnit* contentSU, ODTypeList* typeList) { TempODType hfsType = kODNULL; TRY ODULong count; ODULong index; Environment* ev = somGetGlobalEnvironment(); ODTranslation* translation = contentSU->GetSession(ev)->GetTranslation(ev); hfsType = translation->GetISOTypeFromPlatformType(ev, kODFileType_hfs, kODPlatformDataType); contentSU->Focus(ev, kODPropContents, kODPosUndefined, 0, 0, kODPosUndefined); count = contentSU->CountValues(ev); for (index = 1; index <= count; ++index) { contentSU->Focus(ev, kODPropContents, kODPosUndefined, 0, index, kODPosUndefined); TempODType type = contentSU->GetType(ev); if ( !ODISOStrEqual(type, hfsType) ) typeList->AddLast(ev, type); } CATCH_ALL ENDTRY }
testSequence() { Environment *ev = somGetGlobalEnvironment(); Employee *emp1, *emp2; Company *comp; _IDL_SEQUENCE_Employee list; short i; emp1 = new Employee; emp1->_set_name(ev, "Mary"); emp2 = new Employee; emp2->_set_name(ev, "John"); comp = new Company; comp->addEmployee(ev, emp1); comp->addEmployee(ev, emp2); list = comp->_get_empList(ev); for (i=0; i < sequenceLength(list); i++) { cout << sequenceElement(list,i)->_get_name(ev) << "\n"; } }
ODULong ReadSize(ODFileRefNum file, ODStorageUnitView* view) { ODULong data; ODSLong length = sizeof(data); ODSLong savedLength = length; Environment* ev = somGetGlobalEnvironment (); if (view) // if a prefocused storage unit is passed in length = StorageUnitViewGetValue(view, ev, length, &data); else { // a file ref has been passed in #ifdef _PLATFORM_MACINTOSH_ THROW_IF_ERROR(FSRead(file, &length, (long *)&data)); #endif #ifdef _PLATFORM_WIN32_ DWORD bytesRead; BOOL successful; successful = ReadFile(file, &data, length, &bytesRead, NULL); if (!successful) THROW (GetLastError()); length = bytesRead; #endif // defined _PLATFORM_WIN32_ } if (savedLength != length) THROW(kODErrReadErr); return data; }
SOM_Scope void SOMLINK somDefaultInit(dBigDog somSelf, somInitCtrl* ctrl) { dBigDogData *somThis; /* set in BeginInitializer */ somInitCtrl globalCtrl; somBooleanVector myMask; dBigDogMethodDebug("dBigDog","somDefaultInit"); dBigDog_BeginInitializer_somDefaultInit; dBigDog_Init_dDog_somDefaultInit(somSelf, ctrl); __set_noise(somSelf, somGetGlobalEnvironment(), "WOOF, WOOF"); }
main(int argc, char *argv[], char *envp[]) { Hello myhello; Environment *ev; ev = somGetGlobalEnvironment(); myhello = HelloNew(); __set_msg(myhello, ev, "Hello World from SOM"); _printHello(myhello,ev); _somFree(myhello); }
main(int argc, char *argv[], char *envp[]) { Environment *ev; A *myObj; ev = somGetGlobalEnvironment(); myObj = new A; myObj->_set_val1(ev,5); myObj->_set_val2(ev,100); myObj->display(ev); }
void main(int argc, char **argv) { Environment *ev = somGetGlobalEnvironment(); OESSample_VeryBigCo * companyObj, *tmpCo; SOM_InitEnvironment(ev); // Setup for processing SOMD_Init(ev); tmpCo = (OESSample_VeryBigCo *) (void *) somdCreate(ev, "OESSample::VeryBigCo", FALSE); checkException(ev, "Company -- Creating the company object"); companyObj = (OESSample_VeryBigCo *) (void *) tmpCo->init_for_object_creation(ev); checkException(ev, "Company -- Initializing the company object"); ((SOMDObject *)tmpCo)->release(ev); checkException(ev, "Company -- Dis-associating pointer from company object storage"); companyObj->populate(ev); somPrintf("******* REMOTE OBJECT CREATED ON THE OBJSERVER ********\n"); ExtendedNaming_ExtendedNamingContext *nameContext; char *kind = "object interface"; // Define the name char *id = "Dept45"; // for the Department CosNaming_NameComponent nameComponent = {id, kind}; // 45 object that is CosNaming_Name name = { 1, 1, &nameComponent }; // embedded in companyObj nameContext = (ExtendedNaming_ExtendedNamingContext*) SOMD_ORBObject->resolve_initial_references(ev, "NameService"); checkException(ev, "Company -- Fetch reference to root naming context"); // Register the Department 45 object with the Naming Server. nameContext->bind(ev, &name, (SOMObject*) ((void *) companyObj->_get_dept45(ev)) ); if (ev->_major == USER_EXCEPTION) { if(strcmp(ev->exception._exception_name, "::CosNaming::NamingContext::AlreadyBound") == 0) { somExceptionFree(ev); nameContext->unbind(ev, &name); nameContext->bind(ev, &name, (SOMObject*) ((void *) companyObj->_get_dept45(ev)) ); } else { somPrintf("Department 45 object bind failed\n"); exit(1); } } somPrintf("******* REMOTE OBJECT REGISTERED WITH THE NAME SERVER ********\n"); somPrintf("******* You may now run client1 and/or client2 ********\n"); }
//------------------------------------------------------------------------------ // GetCurrentEditorForPart //------------------------------------------------------------------------------ ODEditor EXPENTRY GetCurrentEditorForPart(ODPart* part ) { Environment* fev = somGetGlobalEnvironment(); // call the PartWrapper and ask what editor it is using ODEditor theEditor = ((ODPartWrapper*)part)->GetEditor(fev); // allocate a buffer to hold the editor name and copy the name ODUShort length = (ODUShort)ODISOStrLength(theEditor); ODEditor partName = (ODEditor)ODNewPtrClear( length+1 );; ODBlockMove(theEditor, partName, length+1 ); return partName; }
//------------------------------------------------------------------------------ // GetUserEditorFromEditor //------------------------------------------------------------------------------ ODBoolean GetUserEditorFromEditor( ODNameSpaceManager* theNmSpcMgr, ODEditor editor, ODName** name ) { ODBoolean result = kODFalse ; Environment* ev = somGetGlobalEnvironment(); // look it up in the spaceName namespace ODValueNameSpace* userStringNameSpace = (ODValueNameSpace*)theNmSpcMgr->HasNameSpace( ev, kODEditorUserString ); if (userStringNameSpace) result = ValueNameSpaceGetODName(userStringNameSpace, ev, editor, name ); return result ; }
SOM_Scope void SOMLINK ODStorageUnitViewsomUninit(ODStorageUnitView *somSelf) { ODStorageUnitViewData *somThis = ODStorageUnitViewGetData(somSelf); ODStorageUnitViewMethodDebug("ODStorageUnitView","ODStorageUnitViewsomUninit"); Environment* ev = somGetGlobalEnvironment(); try { ODSafeReleaseObject(_fSU); delete _fCursor; } catch (ODException _exception) { ODSetSOMException(ev, _exception); } }
static SDL_AudioDevice *Audio_CreateDevice(int devindex) { SDL_AudioDevice *this; /* * Allocate and initialize management storage and private management * storage for this SDL-using library. */ this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); if ( this ) { memset(this, 0, (sizeof *this)); this->hidden = (struct SDL_PrivateAudioData *)malloc((sizeof *this->hidden)); } if ( (this == NULL) || (this->hidden == NULL) ) { SDL_OutOfMemory(); if ( this ) { free(this); } return(0); } memset(this->hidden, 0, (sizeof *this->hidden)); #ifdef DEBUG_AUDIO fprintf(stderr, "Creating UMS Audio device\n"); #endif /* * Calls for UMS env initialization and audio object construction. */ this->hidden->ev = somGetGlobalEnvironment(); this->hidden->umsdev = UMSAudioDeviceNew(); /* * Set the function pointers. */ this->OpenAudio = UMS_OpenAudio; this->WaitAudio = NULL; /* we do blocking output */ this->PlayAudio = UMS_PlayAudio; this->GetAudioBuf = UMS_GetAudioBuf; this->CloseAudio = UMS_CloseAudio; this->free = Audio_DeleteDevice; #ifdef DEBUG_AUDIO fprintf(stderr, "done\n"); #endif return this; }
void SetCategory(ODEditor editorID, ODType kindID, HWND categoryItem, ODSession* session) { ODPartHandlerRegistryInt* ODRegistry; _IDL_SEQUENCE_string CategoryList; ODName* name; ODPtr strHandle = 0; ODSShort i = 0; Environment* ev = somGetGlobalEnvironment(); ODRegistry = session -> GetRegistry(ev); // retrieve Category list from Registry // this is a buffer that the Registry allocates and we need to dispose of. CategoryList = ODRegistry-> GetCategoryList( ev, editorID, kindID); if (CategoryList. _length ) { // Copy the Category name to dialog box and select it i = 0; #if defined(_PLATFORM_WIN32_) SendMessage(categoryItem, LB_ADDSTRING, 0, (LPARAM)CategoryList. _buffer[i]); SendMessage(categoryItem, LB_SETCURSEL, (WPARAM)0, 0); #elif defined(_PLATFORM_OS2_) WinSendMsg(categoryItem, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP(CategoryList. _buffer[i])); WinSendMsg(categoryItem, LM_SELECTITEM, MPFROMSHORT(0), MPFROMSHORT(TRUE)); #elif defined(_PLATFORM_UNIX_) // need display call for aix implementation #endif } // now free up the buffer we got from the Registry for ( i = 0; i < CategoryList. _length; i++) { SOMFree( CategoryList. _buffer[i]); } SOMFree( CategoryList. _buffer); }
//------------------------------------------------------------------------------ // GetThisKindFromList //------------------------------------------------------------------------------ ODType GetThisKindFromList(ODSShort kindItem, ODTypeList* kindList) { Environment* ev = somGetGlobalEnvironment(); ODType type = kODNULL; ODTypeListIterator* kindIter = kindList->CreateTypeListIterator(ev); for ( type = kindIter->First(ev); (--kindItem > 0) && kindIter->IsNotComplete(ev); type = kindIter->Next(ev) ) { ODDisposePtr(type); type = kODNULL; } ODDeleteObject(kindIter); return type; }
/* * Default object initializer */ SOM_Scope void SOMLINK somDefaultInit(SampleClass *somSelf, som3InitCtrl* ctrl) { SampleClassData *somThis; /* set in BeginInitializer */ somInitCtrl globalCtrl; somBooleanVector myMask; SampleClassMethodDebug("SampleClass","somDefaultInit"); SampleClass_BeginInitializer_somDefaultInit; SampleClass_Init_CosStream_Streamable_somDefaultInit(somSelf, ctrl); /* * local SampleClass initialization code added by programmer */ Environment *ev = somGetGlobalEnvironment(); somThis->name = (char *)NULL; somThis->cc = (ContainedClass*) NULL; }
SOM_Scope void SOMLINK somDefaultInit(dAnimal somSelf, somInitCtrl* ctrl) { dAnimalData *somThis; /* set in BeginInitializer */ Environment *ev; somInitCtrl globalCtrl; somBooleanVector myMask; dAnimalMethodDebug("dAnimal","somDefaultInit"); dAnimal_BeginInitializer_somDefaultInit; dAnimal_Init_SOMObject_somDefaultInit(somSelf, ctrl); ev = somGetGlobalEnvironment(); __set_name(somSelf, ev, "unknown name"); __set_type(somSelf, ev, "unknown type"); __set_food(somSelf, ev, "unknown food"); _loc = dLocationNew(); _buff = SOMMalloc(2048); }
void ChangeEditor(ODPart* part, ODEditor editorID) { Environment* ev = somGetGlobalEnvironment(); ((ODPartWrapper*)part)->UseEditor(ev, editorID); // Need to acquire storage unit before using it. Put it in // temp object so that the storage unit is released when // the temp object is out of scope. TempODStorageUnit thePartSU = part->GetStorageUnit(ev); thePartSU->Acquire(ev); if (thePartSU->Exists(ev, kODPropPreferredEditor, kODEditor, 0 )) thePartSU->Focus(ev, kODPropPreferredEditor,kODPosSame,kODEditor,0,kODPosSame); else { thePartSU->AddProperty(ev, kODPropPreferredEditor ); thePartSU->AddValue( ev, kODEditor ); } StorageUnitSetValue(thePartSU, ev, ODISOStrLength((const ODISOStr)editorID)+1,(ODValue)editorID); }
//------------------------------------------------------------------------------ // EditorSupportsKind //------------------------------------------------------------------------------ ODBoolean EditorSupportsKind( ODNameSpaceManager* theNmSpcMgr, ODEditor editor, ODType kind ) { ODTypeList* kindsList = kODNULL; Environment* ev = somGetGlobalEnvironment(); // get the editorkinds namespace ODObjectNameSpace* editorkindsNameSpace = (ODObjectNameSpace*)theNmSpcMgr->HasNameSpace( ev, kODEditorKinds ); if (editorkindsNameSpace) { // Lookup the kinds list by editor class ID if (!editorkindsNameSpace->GetEntry( ev, (ODISOStr)editor, (ODObject**)&kindsList )) kindsList = (ODTypeList*)kODNULL; } return (kindsList && kindsList->Contains(ev, kind)); }
SOM_Scope void SOMLINK somDestruct(AppointmentBookFactory *somSelf, octet doFree, som3DestructCtrl* ctrl) { Environment *ev = somGetGlobalEnvironment(); AppointmentBookFactoryData *somThis; /* set in BeginDestructor */ somDestructCtrl globalCtrl; somBooleanVector myMask; AppointmentBookFactoryMethodDebug("AppointmentBookFactory","somDestruct"); AppointmentBookFactory_BeginDestructor; /* * local AppointmentBookFactory deinitialization code added by programmer */ (somThis->nameContext)->destroy(ev); somThis->nameContext=(CosNaming_NamingContext *)OBJECT_NIL; (somThis->AppointmentNameContext)->destroy(ev); somThis->AppointmentNameContext=(CosNaming_NamingContext *)OBJECT_NIL; AppointmentBookFactory_EndDestructor; }
main() { Environment *ev; ErrorExample *ex1; char *exId; BadCall *bc; StExcep *stExVal; ev = somGetGlobalEnvironment(); ex1 = new ErrorExample; ex1->execute(ev); switch(ev->_major) { case SYSTEM_EXCEPTION: exId = somExceptionId(ev); stExVal = (StExcep *) somExceptionValue(ev); cout << "Minor Code " << stExVal->minor; cout << "Status " << stExVal->completed; somExceptionFree(ev); break; case USER_EXCEPTION: exId = somExceptionId(ev); if (strcmp(exId, ex_ErrorExample_BadCall) == 0) { bc = (BadCall *) somExceptionValue(ev); cout << bc->errorCode << "\n"; cout << bc->reason << "\n"; somExceptionFree(ev); // Free exception memory } break; case NO_EXCEPTION: break; } }
//************************************************************************** // ApptDialog :: command - Process Commands * //************************************************************************** Boolean ApptDialog :: command(ICommandEvent& cmdevt) { Environment *ev = somGetGlobalEnvironment(); ITime starttime(fldStarthr.value(), fldStartmin.value()); ITime stoptime(fldStophr.value(), fldStopmin.value()); switch(cmdevt.commandId()) { case DID_OK: switch (apptType) { case MEETING: apptObject->_set_start(ev,starttime.asSeconds()); apptObject->_set_end(ev,stoptime.asSeconds()); apptObject->_set_subject(ev,mleSubj.text()); ((Meeting *)apptObject)->_set_location(ev,fldLoc.text()); break; case CCALL: apptObject->_set_start(ev,starttime.asSeconds()); apptObject->_set_end(ev,stoptime.asSeconds()); apptObject->_set_subject(ev,mleSubj.text()); ((ConferenceCall *)apptObject)->_set_phoneNumber(ev,fldPhone.text()); break; default: break; } /* End switch*/ dismiss(DID_OK); return(true); break; case DID_CANCEL: dismiss(DID_CANCEL); return(true); break; }/* end switch */ return(false); //Allow Default Processing to occur }
ODBoolean ODObjectOrdColl::ElementsMatch(ElementType v1,ElementType v2) const { Environment* ev = somGetGlobalEnvironment(); return ODObjectsAreEqual(ev, (ODObject*) v1, (ODObject*) v2); }
//************************************************************************** // NameDialog :: command - Process Commands * //************************************************************************** Boolean UpdlDialog :: command(ICommandEvent& cmdevt) { long index=-1; Appointment *appt; Environment *ev = somGetGlobalEnvironment(); switch(cmdevt.commandId()) { case DID_OK: // If a selection was made if ( *IDValue >= 0 ) { // Ok is pressed get the modifications if there are some if (sequenceLength(apptList)>0) { appt = sequenceElement(apptList,*IDValue); if (appt->somIsA(_ConferenceCall)) { // Check to see if the entry changed if (fldPhone.hasChanged()) { fldPhone.selectRange(); new_phone=fldPhone.selectedText(); } } else { if (fldLocation.hasChanged()) { fldLocation.selectRange(); new_location=fldLocation.selectedText(); } } if (fldSubject.hasChanged()) { fldSubject.selectRange(); new_subject=fldSubject.selectedText(); } } /* endif */ } dismiss(DID_OK); return(true); break; case DID_CANCEL: dismiss(DID_CANCEL); return(true); break; case DID_SELECT: index = listBox.selection(); // return index to selection if (sequenceLength(apptList)>0) { btnOk.enable(); // enable ok since a selection is made if (index >= 0) { appt = sequenceElement(apptList,index); if (!fldPhone.isEmpty()) { fldPhone.selectRange(); fldPhone.clear(); } if (!fldLocation.isEmpty()) { fldLocation.selectRange(); fldLocation.clear(); } if (!fldSubject.isEmpty()) { fldSubject.selectRange(); fldSubject.clear(); } if (appt->somIsA(_ConferenceCall)) { fldPhone.enable(); fldPhone.setText(((ConferenceCall *)appt)->_get_phoneNumber(ev)); fldLocation.disable(); } else { fldLocation.enable(); fldLocation.setText(((Meeting *)appt)->_get_location(ev)); fldPhone.disable(); } fldSubject.enable(); fldSubject.setText(appt->_get_subject(ev)); *IDValue = index; } } return(true); break; }/* end switch */ return(false); //Allow Default Processing to occur }
static int aix_init(const char *param, int *speed, int *fragsize, int *fragnr, int *channels) { int st, tmp, i; /* No stereo capability. */ *channels = 1; /* open device */ ev = somGetGlobalEnvironment(); audio_device = UMSBAUDDeviceNew(); rc = UMSAudioDevice_open(audio_device, ev, "/dev/paud0", "PLAY", UMSAudioDevice_BlockingIO); if (audio_device == NULL) { fprintf(errfile,"can't create audio device object\nError: %s\n", error_string); return 1; } rc = UMSAudioDevice_set_volume(audio_device, ev, 100); rc = UMSAudioDevice_set_balance(audio_device, ev, 0); rc = UMSAudioDevice_set_time_format(audio_device, ev, UMSAudioTypes_Msecs); if (obyte_order) lib_free(obyte_order); rc = UMSAudioDevice_set_byte_order(audio_device, ev, "LSB"); /* set 16bit */ rc = UMSAudioDevice_set_bits_per_sample(audio_device, ev, 16); rc = UMSAudioDevice_set_audio_format_type(audio_device, ev, "PCM"); rc = UMSAudioDevice_set_number_format(audio_device, ev, "TWOS_COMPLEMENT"); /* set speed */ rc = UMSAudioDevice_set_sample_rate(audio_device, ev, *speed, &out_rate); /* channels */ rc = UMSAudioDevice_set_number_of_channels(audio_device, ev, 1); /* should we use the default? */ left_gain = right_gain = 100; rc = UMSAudioDevice_enable_output(audio_device, ev, "LINE_OUT", &left_gain, &right_gain); /* set buffer size */ tmp = (*fragsize) * (*fragnr) * sizeof(SWORD); buffer._maximum = tmp; buffer._buffer = (char *)lib_malloc(tmp); buffer._length = 0; rc = UMSAudioDevice_initialize(audio_device, ev); rc = UMSAudioDevice_start(audio_device, ev); return 0; #if 0 /* XXX: AIX: everything should check rc, this isn't used now */ fail: UMSAudioDevice_stop(audio_device, ev); UMSAudioDevice_close(audio_device, ev); _somFree(audio_device); lib_free(buffer._buffer); audio_device = NULL; return 1; #endif }
//************************************************************************** // 1 2 3 * // Col-> 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 * // Row * // 1 ----------------- Appointment * // 2 | | --------------------- * // 3 | | Phone : | | * // 4 | | --------------------- * // 5 | | --------------------- * // 6 | | Location: | | * // 7 | | --------------------- * // 8 | | ---------------------- * // 9 | | Subject: | | * // 10 | | | | * // 11 | | | | * // 12 ----------------- | | * // 13 ---------------------- * // 14 Users: ��������������������������������������������Ŀ * // 15 � � * // 16 � � * // 17 � � * // 18 � � * // 19 � � * // 20 ���������������������������������������������� * // 21 ������������Ŀ ������������Ŀ ������������Ŀ * // 22 � � � � � � * // 23 �������������� �������������� �������������� * //************************************************************************** // UpdlDialog :: UpdlDialog - Get a book name * //************************************************************************** UpdlDialog :: UpdlDialog(_IDL_SEQUENCE_Appointment apptList, long *index, unsigned long windowId, IWindow * ownerWnd) : IFrameWindow(windowId, desktopWindow(), // parent ownerWnd, // owner IRectangle(500, // width 400), // height IWindow::synchPaint |IWindow::clipSiblings |IWindow::saveBits |systemMenu |titleBar |dialogBorder |dialogBackground ), clientCanvas(WND_CANVAS_UPDLDIALOG,this,this), buttons(WND_CANVAS_UPDLDIALOGBTN,this,this), listBox(LB_APPTS,&clientCanvas,&clientCanvas,IRectangle()), multicCanvas(WND_CANVAS_UPDLMCDIALOG, &clientCanvas, &clientCanvas, IRectangle()), txtAppointment(STR_APPOINTMENT,&multicCanvas,&multicCanvas), txtPhone(STR_PHONE,&multicCanvas,&multicCanvas), txtLocation(STR_LOCATION,&multicCanvas,&multicCanvas), txtSubject(STR_SUBJECT,&multicCanvas,&multicCanvas), fldPhone(DDL_PHONE,&multicCanvas,&multicCanvas), fldLocation(DDL_LOCATION,&multicCanvas,&multicCanvas), fldSubject(DDL_SUBJECT,&multicCanvas,&multicCanvas), // UserCanvas(WND_CANVAS_UPDLUSERDIALOG, &clientCanvas, &clientCanvas), // lboxUsers(LB_USERS,&UserCanvas,&UserCanvas), // txtUsers(TXT_USERS,&UserCanvas,&UserCanvas), btnOk(DID_OK,&buttons,&buttons), btnCancel(DID_CANCEL,&buttons,&buttons), btnSelect(DID_SELECT,&buttons,&buttons), apptList(apptList), IDValue(index) { string bp; strstream ss; Appointment *appt; Environment *ev = somGetGlobalEnvironment(); setClient(&clientCanvas); clientCanvas.setOrientation(ISplitCanvas::verticalSplit); clientCanvas.setSplitWindowPercentage(&multicCanvas, 60); clientCanvas.setSplitWindowPercentage(&listBox, 40); //UserCanvas.setOrientation(ISplitCanvas::horizontalSplit); IWindow::enable(1); IHandler::enable(1); listBox.enable(1); ICommandHandler::handleEventsFor(this); // Set self as command event handler if (sequenceLength(apptList)>0) { for (int i=0; sequenceLength(apptList)>i; i++) { appt = sequenceElement(apptList,i); ss << ITime(appt->_get_start(ev)) << " to " << ITime(appt->_get_end(ev)) << endl; listBox.addAsLast(bp=ss.str()); ss.rdbuf()->seekoff(0, ios::beg, ios::in|ios::out); } ss.rdbuf()->freeze(0); // release string buffer } txtAppointment.setText(STR_APPOINTMENT); txtPhone.setText(STR_PHONE); txtLocation.setText(STR_LOCATION); txtSubject.setText(STR_SUBJECT); // Disable until the appointment is selected fldLocation.disable(); fldPhone.disable(); fldSubject.disable(); *IDValue = -1; // Initialize the IDValue //txtUsers.setText(STR_USERS); btnOk.setText(STR_OK); btnOk.disable(); // disable until a selection is made btnCancel.setText(STR_CANCEL); btnSelect.setText(STR_SELECT); if (windowId == WND_DELAPPTDIALOG) { // Set everything to read only fldPhone.enableDataUpdate(false); fldLocation.enableDataUpdate(false); fldSubject.enableDataUpdate(false); } // Field Col Row #Col #Row multicCanvas.addToCell(&txtAppointment , 2, 2, 12, 1); multicCanvas.addToCell(&txtPhone , 2, 3, 2, 1); multicCanvas.addToCell(&txtLocation , 2, 6, 2, 1); multicCanvas.addToCell(&txtSubject , 2, 9, 2, 1); multicCanvas.addToCell(&fldPhone , 6, 3, 10, 1); multicCanvas.addToCell(&fldLocation , 6, 6, 10, 1); multicCanvas.addToCell(&fldSubject , 6, 9, 10, 1); setFocus(); buttons.setMargin(ISize()); // Set Canvas Margins to zero buttons.setPad(ISize()); // Set Button Canvas Pad to zero addExtension(&buttons, IFrameWindow::belowClient, (unsigned long)buttons.minimumSize().height()+10); listBox.setFocus(); }