long fx_disp_lookup_window::on_changed_component_name(FXObject *, FXSelector sel, void *text) { int index = FXSELID(sel) - ID_COMPONENT_NAME; disp_lookup *lookup = &disp->disp.lookup; str_copy_c(lookup->component[index].disp->name, (FXchar *)text); return 1; }
long Foam::viewer::switchProj(FXObject * obj ,FXSelector sel ,void* ptr) { if (FXSELID(sel) == viewer::ID_PARALLEL) { glviewer_->setProjection(FXGLViewer::PARALLEL); parallelProj_->setCheck(TRUE); perspectiveProj_->setCheck(FALSE); } else if (FXSELID(sel) == viewer::ID_PERSPECTIVE) { glviewer_->setProjection(FXGLViewer::PERSPECTIVE); parallelProj_->setCheck(FALSE); perspectiveProj_->setCheck(TRUE); } return 1; }
long GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdSwitchTLSLogic( FXObject*, FXSelector sel, void*) { assert(myObject->getType() == GLO_TLLOGIC); static_cast<GUITrafficLightLogicWrapper*>(myObject)->switchTLSLogic(FXSELID(sel) - MID_SWITCH); return 1; }
void CommandUtils::SetKillKey(FXHotKey k) { killkey=k; #ifdef WIN32 winkey=VkKeyScan(FXSELID(killkey)); #endif }
long fx_disp_window::on_disp_element_delete(FXObject*, FXSelector sel, void *) { int index = FXSELID(sel) - ID_DISP_ELEMENT_DELETE; this->delete_dispersion_element(index); return 1; }
long fx_disp_window::on_cmd_value(FXObject*, FXSelector sel, void *data) { double *pvalue = this->map_parameter(FXSELID(sel) - ID_PARAM_0); double new_value = strtod((FXchar*)data, NULL); *pvalue = new_value; return 1; }
// Entered snapper window long ShutterBug::onEnterSnapper(FXObject*,FXSelector sel,void* ptr){ register FXuchar m=MODE_WHOLERECT; if(!(((FXEvent*)ptr)->state&CONTROLMASK) && (0==size)){ m=where(((FXEvent*)ptr)->root_x,((FXEvent*)ptr)->root_y); } changeCursor(FXSELID(sel)-ID_SNAPPER_0,m); return 1; }
long fx_disp_lookup_window::on_button_menu_component(FXObject*sender, FXSelector sel, void *ptr) { FXEvent *event = (FXEvent *) ptr; selected_component = FXSELID(sel) - ID_MENU_COMPONENT; if(!event->moved){ popupmenu->popup(NULL, event->root_x, event->root_y); getApp()->runModalWhileShown(popupmenu); } return 1; }
// Moved snapper long ShutterBug::onMovedSnapper(FXObject*,FXSelector sel,void* ptr){ register FXint which=FXSELID(sel)-ID_SNAPPER_0; register FXEvent *event=(FXEvent*)ptr; register FXuchar m; FXint t; FXTRACE((1,"%s::onMovedSnapper %d,%d\n",getClassName(),((FXEvent*)ptr)->win_x,((FXEvent*)ptr)->win_y)); if(mode!=MODE_NONE){ // Move whole rectangle if(mode&MODE_WHOLERECT){ rectangle.x=event->root_x-spotx; rectangle.y=event->root_y-spoty; } // Move corner of rectangle else{ // Vertical if(mode&MODE_TOP){ t=rectangle.y+rectangle.h-event->root_y+spoty; if(t>=MINSIZE){ rectangle.h=t; rectangle.y=event->root_y-spoty; } } else if(mode&MODE_BOTTOM){ t=event->root_y-spoty-rectangle.y; if(t>=MINSIZE){ rectangle.h=t; } } // Horizontal if(mode&MODE_LEFT){ t=rectangle.x+rectangle.w-event->root_x+spotx; if(t>=MINSIZE){ rectangle.w=t; rectangle.x=event->root_x-spotx; } } else if(mode&MODE_RIGHT){ t=event->root_x-spotx-rectangle.x; if(t>=MINSIZE){ rectangle.w=t; } } } // Update rectangle moveSnapRectangle(rectangle); m=mode; } else{ if((event->state&CONTROLMASK) || size) m=MODE_WHOLERECT; else m=where(event->root_x,event->root_y); } changeCursor(which,m); return 1; }
long fit_panel::on_update_undo_menu(FXObject* sender, FXSelector sel, void *) { FXMenuCommand *menu_cmd = (FXMenuCommand *) sender; bool enabled = menu_cmd->isEnabled(); bool available = (FXSELID(sel) == ID_ACTION_UNDO ? m_undo_manager.has_undo() : m_undo_manager.has_redo()); if (enabled && !available) { menu_cmd->disable(); return 1; } if (!enabled && available) { menu_cmd->enable(); return 1; } return 0; }
long CALCDigitBox::onPopupMenu(FXObject*,FXSelector sel,void* ptr) { #ifdef HAVE_RTTI FXString str=""; //Attemp to get tip text switch(FXSELID(sel)) { case FXSpinner::ID_INCREMENT: case FXSpinner::ID_DECREMENT: case FXSpinner::ID_ENTRY: case ID_NUMDIGITS: str=DIGITNUMDIGITS_HELP; break; case ID_DEFAULTDIGITS: str=DIGITDEFAULTDIGITS_HELP; break; } if(!str.empty()) { FXEvent* event=(FXEvent*)ptr; FXMenuPane pane(this); new FXMenuCommand(&pane,"&Huh?",NULL,this,ID_CLARIFY); clarify=FALSE; pane.create(); pane.popup(NULL,event->root_x,event->root_y); getApp()->runModalWhileShown(&pane); if(clarify) { FXMenuPane clarification(this,FRAME_LINE); FXButton* button=new FXButton(&clarification,str,NULL,&clarification,FXWindow::ID_HIDE,JUSTIFY_LEFT); button->setFont(getApp()->getNormalFont()); button->setTextColor(getApp()->getForeColor()); button->setBackColor(FXRGB(255,255,192)); clarification.create(); clarification.popup(NULL,event->root_x,event->root_y); getApp()->runModalWhileShown(&clarification); } } #endif return 1; }
void CommandUtils::InitKillKey() { SetKillKey(parseAccel(killcmd->accel)); if (killkey && FXSELID(killkey)) { temp_accels=new FXAccelTable(); temp_accels->addAccel(killkey,this,FXSEL(SEL_COMMAND,killcmd->sel),0); } else { FXMessageBox::warning(tw->getApp(), MBOX_OK, _("Configuration error"), "%s \"%s\"\n%s", _("Failed to parse accelerator for"), killcmd->pref, _("disabling support for macros and external commands.") ); temp_accels=NULL; } }
long GenesisFrame::onHeader(FXObject *a_src, FXSelector a_sel, void *) { m_headerChoice = FXSELID(a_sel); m_overrideHeader->setCheck(a_src == m_overrideHeader); m_overrideNoHeader->setCheck(a_src == m_overrideNoHeader); if (a_src == m_overrideHeaderSize) { m_overrideHeaderSize->setCheck(); m_overrideHeaderSizeText->enable(); } else { m_overrideHeaderSize->setCheck(FALSE); m_overrideHeaderSizeText->disable(); } return 1; }
long fit_panel::on_cmd_undo(FXObject*, FXSelector sel, void *) { FXuint id = FXSELID(sel); bool done; if (id == ID_ACTION_UNDO) { done = m_undo_manager.undo(m_fit); } else { done = m_undo_manager.redo(m_fit); } if (done) { refresh(); if(m_canvas) { m_canvas->update_limits(); } return 1; } return 0; }
long recipe_window::on_select_param(FXObject *, FXSelector sel, void *) { int id = FXSELID(sel); multi_sample_recipe *ms = recipe->ms_setup; const fit_param_t *selfp; if (id == ID_PARAM_INDIV) { FXint index = iparams_listbox->getCurrentItem(); /* Get the selected fit parameter. */ selfp = &ms->iparameters->values[index]; } else { FXint index = cparams_listbox->getCurrentItem(); /* Get the selected fit parameter. */ selfp = &ms->cparameters->values[index]; } /* Find the index of the fit parameter in the list of all possible parameters. */ int fp_index = fit_parameters_find(param_list, selfp); /* Select in the listbox the given parameter. */ listbox_select_parameter(param_listbox, fp_index); return 1; }
long dlgReglas::onCmdCambio(FXObject *sender, FXSelector sel, void *) { // Actualizamos el nombre correspondiente switch( FXSELID(sel) ) { case ID_CAMBIO_NOM: reglas[indxRegla].nombre = nomActual; break; case ID_CAMBIO_PAT: reglas[indxRegla].patron = patActual; break; case ID_CAMBIO_FG: reglas[indxRegla].colorFG = fgActual; break; case ID_CAMBIO_BG: reglas[indxRegla].colorBG = bgActual; break; } return 1; }
// Change size mode long ShutterBug::onCmdSize(FXObject*,FXSelector sel,void*){ size=FXSELID(sel)-ID_SIZE_CUSTOM; if(size){ if(size<0){ rectangle.x=0; rectangle.y=0; rectangle.w=getRoot()->getDefaultWidth(); rectangle.h=getRoot()->getDefaultHeight(); } else{ if(rectangle.x>getRoot()->getDefaultWidth()-size){ rectangle.x=getRoot()->getDefaultWidth()-size; } if(rectangle.y>getRoot()->getDefaultHeight()-size){ rectangle.y=getRoot()->getDefaultHeight()-size; } if(rectangle.x<0){ rectangle.x=0; } if(rectangle.y<0){ rectangle.y=0; } rectangle.w=size; rectangle.h=size; } FXTRACE((1,"x=%d y=%d w=%d h=%d\n",rectangle.x,rectangle.y,rectangle.w,rectangle.h)); moveSnapRectangle(rectangle); } return 1; }
// Pressed on snapper long ShutterBug::onPressSnapper(FXObject*,FXSelector sel,void* ptr){ register FXint which=FXSELID(sel)-ID_SNAPPER_0; register FXEvent *event=(FXEvent*)ptr; if((event->state&CONTROLMASK) || (event->type!=SEL_LEFTBUTTONPRESS) || size){ mode=MODE_WHOLERECT; spotx=event->root_x-rectangle.x; spoty=event->root_y-rectangle.y; } else{ mode=where(event->root_x,event->root_y); if(mode&MODE_TOP) spoty=event->root_y-rectangle.y; else if(mode&MODE_BOTTOM) spoty=event->root_y-rectangle.y-rectangle.h; if(mode&MODE_LEFT) spotx=event->root_x-rectangle.x; else if(mode&MODE_RIGHT) spotx=event->root_x-rectangle.x-rectangle.w; } changeCursor(which,mode); snapper[0]->raise(); snapper[1]->raise(); snapper[2]->raise(); snapper[3]->raise(); raise(); return 1; }
// Update change size mode long ShutterBug::onUpdSize(FXObject* sender,FXSelector sel,void*){ sender->handle(this,size==FXSELID(sel)-ID_SIZE_CUSTOM?FXSEL(SEL_COMMAND,ID_CHECK):FXSEL(SEL_COMMAND,ID_UNCHECK),NULL); return 1; }
long GUISUMOViewParent::onCmdLocate(FXObject*, FXSelector sel, void*) { GUIGlObjectType type; std::vector<GUIGlID> ids; GUIIcon icon; std::string title; switch (FXSELID(sel)) { case MID_LOCATEJUNCTION: type = GLO_JUNCTION; ids = static_cast<GUINet*>(GUINet::getInstance())->getJunctionIDs(myParent->listInternal()); icon = ICON_LOCATEJUNCTION; title = "Junction Chooser"; break; case MID_LOCATEEDGE: type = GLO_EDGE; ids = GUIEdge::getIDs(myParent->listInternal()); icon = ICON_LOCATEEDGE; title = "Edge Chooser"; break; case MID_LOCATEVEHICLE: type = GLO_VEHICLE; static_cast<GUIVehicleControl&>(MSNet::getInstance()->getVehicleControl()).insertVehicleIDs(ids); icon = ICON_LOCATEVEHICLE; title = "Vehicle Chooser"; break; case MID_LOCATETLS: type = GLO_TLLOGIC; ids = static_cast<GUINet*>(GUINet::getInstance())->getTLSIDs(); icon = ICON_LOCATETLS; title = "Traffic Lights Chooser"; break; case MID_LOCATEADD: type = GLO_ADDITIONAL; ids = GUIGlObject_AbstractAdd::getIDList(); icon = ICON_LOCATEADD; title = "Additional Objects Chooser"; break; case MID_LOCATEPOI: type = GLO_POI; ids = static_cast<GUIShapeContainer&>(GUINet::getInstance()->getShapeContainer()).getPOIIds(); icon = ICON_LOCATESHAPE; title = "POI Chooser"; break; case MID_LOCATEPOLY: type = GLO_POLYGON; ids = static_cast<GUIShapeContainer&>(GUINet::getInstance()->getShapeContainer()).getPolygonIDs(); icon = ICON_LOCATESHAPE; title = "Polygon Chooser"; break; default: throw ProcessError("Unknown Message ID in onCmdLocate"); } myLocatorPopup->popdown(); myLocatorButton->killFocus(); myLocatorPopup->update(); GUIDialog_GLObjChooser* chooser = new GUIDialog_GLObjChooser( this, GUIIconSubSys::getIcon(icon), title.c_str(), type, ids, GUIGlObjectStorage::gIDStorage); chooser->create(); chooser->show(); return 1; }
// Close dialog long OverwriteBox::onCmdClicked(FXObject*, FXSelector sel, void*) { getApp()->stopModal(this, OVWBOX_CLICKED_CANCEL+(FXSELID(sel)-ID_CLICKED_CANCEL)); hide(); return(1); }
long GUISUMOViewParent::onCmdLocate(FXObject*, FXSelector sel, void*) { std::vector<GUIGlID> ids; GUIIcon icon; std::string title; switch (FXSELID(sel)) { case MID_LOCATEJUNCTION: ids = static_cast<GUINet*>(GUINet::getInstance())->getJunctionIDs(myParent->listInternal()); icon = ICON_LOCATEJUNCTION; title = "Junction Chooser"; break; case MID_LOCATEEDGE: ids = GUIEdge::getIDs(myParent->listInternal()); icon = ICON_LOCATEEDGE; title = "Edge Chooser"; break; case MID_LOCATEVEHICLE: if (MSGlobals::gUseMesoSim) { #ifdef HAVE_INTERNAL static_cast<GUIMEVehicleControl*>(static_cast<GUINet*>(MSNet::getInstance())->getGUIMEVehicleControl())->insertVehicleIDs(ids); #endif } else { static_cast<GUIVehicleControl&>(MSNet::getInstance()->getVehicleControl()).insertVehicleIDs(ids); } icon = ICON_LOCATEVEHICLE; title = "Vehicle Chooser"; break; case MID_LOCATEPERSON: static_cast<GUIPersonControl&>(MSNet::getInstance()->getPersonControl()).insertPersonIDs(ids); icon = ICON_LOCATEPERSON; title = "Person Chooser"; break; case MID_LOCATETLS: ids = static_cast<GUINet*>(GUINet::getInstance())->getTLSIDs(); icon = ICON_LOCATETLS; title = "Traffic Lights Chooser"; break; case MID_LOCATEADD: ids = GUIGlObject_AbstractAdd::getIDList(); icon = ICON_LOCATEADD; title = "Additional Objects Chooser"; break; case MID_LOCATEPOI: ids = static_cast<GUIShapeContainer&>(GUINet::getInstance()->getShapeContainer()).getPOIIds(); icon = ICON_LOCATEPOI; title = "POI Chooser"; break; case MID_LOCATEPOLY: ids = static_cast<GUIShapeContainer&>(GUINet::getInstance()->getShapeContainer()).getPolygonIDs(); icon = ICON_LOCATEPOLY; title = "Polygon Chooser"; break; default: throw ProcessError("Unknown Message ID in onCmdLocate"); } myLocatorPopup->popdown(); myLocatorButton->killFocus(); myLocatorPopup->update(); GUIDialog_GLObjChooser* chooser = new GUIDialog_GLObjChooser( this, GUIIconSubSys::getIcon(icon), title.c_str(), ids, GUIGlObjectStorage::gIDStorage); chooser->create(); chooser->show(); return 1; }
long preferences::downloadInstallPlugin (FXObject * sender, FXSelector sel, void *) { FXushort id=FXSELID(sel); string file; if(id==ID_DOWNLOAD_INSTALL_CMD_PLUGIN) file=string(FXFile::getUserDirectory ("").text ()) +"/.openspace/plugins/cmddialog/commandPluginsList.txt"; else file=string(FXFile::getUserDirectory ("").text ()) +"/.openspace/plugins/filelist/vfsPluginsList.txt"; if(FXFile::exists(file.c_str())) { std::string line; std::ifstream infile (file.c_str()); while (std::getline (infile, line)) { string name; string download; std::stringstream parser (line); parser >> name; parser >> download; if(id==ID_DOWNLOAD_INSTALL_CMD_PLUGIN) if(name==availableCommandPluginsList->getItem(availableCommandPluginsList->getCurrentItem()).text()) { if(name=="") return 0; string cmd="cd "+ string(FXFile::getUserDirectory ("").text ()) +"/.openspace/plugins/cmddialog/ && wget -N --connect-timeout=5 "+ download; system(cmd.c_str()); command_container ct=commandsMap[name]; if(ct.name!="") // already exists return 0; ct.name=name; ct.rescan=false; ct.capture=false; ct.type="PLUGIN"; commandsCombo->appendItem(ct.name.c_str()); commandsMap[name]=ct; commandsCombo->setCurrentItem (commandsCombo->getNumItems () - 1); this->onCommandChange(NULL,0,NULL); fileTypeDefaultBox->appendItem(ct.name.c_str()); additionalCommands->appendItem(ct.name.c_str()); break; } else if(name==availableVfsPluginsList->getItem(availableVfsPluginsList->getCurrentItem()).text()) { if(name=="") return 0; string cmd="cd "+ string(FXFile::getUserDirectory ("").text ()) +"/.openspace/plugins/filelist/ && wget -N --connect-timeout=5 "+ download; system(cmd.c_str()); string plugin_path = FXFile::getUserDirectory ("").text ()+string("/.openspace/plugins/filelist/libfilelist")+ name+".so"; void *dllhandle = fxdllOpen (plugin_path.c_str ()); if (dllhandle) { filelist_base *(*gg) (void); gg = (filelist_base * (*)(void)) fxdllSymbol (dllhandle, "get_filelist"); filelist_base *fb = gg (); vfs v=fb->setup(); conf->removestring ("/OpenspaceConfig/filelist/"+name); conf->addstring("/OpenspaceConfig/filelist",name,""); conf->addstring("/OpenspaceConfig/filelist/"+name,"type",v.type); conf->addstring("/OpenspaceConfig/filelist/"+name,"properties",""); vector <vfsheader_container>::iterator iter; for(iter=v.vfsheaders.begin();iter!=v.vfsheaders.end();iter++) { conf->addstring("/OpenspaceConfig/filelist/"+name+"/properties",iter->name,""); conf->addstring("/OpenspaceConfig/filelist/"+name+"/properties/"+ iter->name,"width",iter->width); conf->addstring("/OpenspaceConfig/filelist/"+name+"/properties/"+ iter->name,"type",iter->type); } vfsList->appendItem(name.c_str()); } } } }
// Release on snapper long ShutterBug::onReleaseSnapper(FXObject*,FXSelector sel,void*){ register FXint which=FXSELID(sel)-ID_SNAPPER_0; mode=MODE_NONE; changeCursor(which,mode); return 1; }
// Change line weigth long ShutterBug::onCmdLineWeight(FXObject*,FXSelector sel,void*){ weight=FXSELID(sel)-ID_WEIGHT_0; moveSnapRectangle(rectangle); return 1; }