int CommodityClassMgr::Reload() { map<u_int32_t, map<u_int32_t, string> > mapClassName; if(m_cDBOptr.GetClassNameMap(mapClassName) != 0) return -1; CommodityClassFullPath cCommodityClassFullPath; return DoReload(0, 1, cCommodityClassFullPath, mapClassName); }
void TlbbScript::Start() { if(!m_start) { m_start = true; m_timerCount = 0; // TODO: 这里是TlbbInstance的成员,要重新整理一下 m_hWnd = GetForegroundWindow(); m_hDC = GetDC(m_hWnd); Beep(987, 100); DoStart(); } else { m_timerCount = 0; Beep(987, 100); DoReload(); } }
/// \brief /// Guarantees that the resource is loaded /// /// One of the key functions of resource management. After calling this function it is /// guaranteed, that the resource is loaded. If the resource wasn't already loaded, the virtual /// Reload() function is called. Furthermore it updates the time stamp for the last accessed /// time. Call this function before any custom resource functions are called that rely on data /// being allocated in the Reload() function. inline void EnsureLoaded() { m_fLastTimeUsed = GetGlobalTime(); if (IsLoaded()) return; DoReload(); }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jdlvFrame::jdlvFrame (const char *fileToLoad) : nextWorld(NULL), isChanged(false), eM(elModeView), genNo(0), curColor(0), speed(3), timerID(0) { QFont fixedFont(jdlvFONTFACENAME, jdlvFONTSIZE); fixedFont.setStyleHint(QFont::TypeWriter); primeWorld = new_elMundoA(); vista = new elVista (this, primeWorld); setCentralWidget(vista); vista->setMinimumSize(720, 480); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - QToolBar *bottom = new permanentToolBar("ctrl", this); bottom->setFloatable(false); bottom->setMovable (false); bottom->setIconSize(QSize(28,25)); showTimeCB = new QAction(QIcon(":/time.png"), QString("time"), this); showInfoPB = new QAction(QIcon(":/info.png"), QString("info"), this); connect(showTimeCB, SIGNAL(triggered(bool)), this, SLOT(ToggleTime(bool))); connect(showInfoPB, SIGNAL(triggered()), this, SLOT(ShowInfo())); bottom->addAction(showTimeCB); bottom->addAction(showInfoPB); showInfoPB->setEnabled(false); //+ bottom->addWidget(new QLabel(" ")); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - QActionGroup *modeGroup = new QActionGroup(this); modeEdit = new QAction(QIcon(":/pen-in-box.png"),QString("Edit (X)"), this); modeView = new QAction(QIcon(":/eye-half.png"), QString("View (Z)"), this); setColor = new QAction(QIcon(":/empty1.png"), QString("color"), this); connect(modeView, SIGNAL(triggered()), this, SLOT(SetModeView())); connect(modeEdit, SIGNAL(triggered()), this, SLOT(SetModeEdit())); connect(setColor, SIGNAL(triggered()), this, SLOT(PopupColorMenu())); showTimeCB->setCheckable(true); modeEdit ->setCheckable(true); modeEdit->setShortcut(QKeySequence("X")); modeView ->setCheckable(true); modeView->setShortcut(QKeySequence("Z")); modeView ->setChecked (true); modeGroup->addAction(modeView); bottom->addAction(modeView); modeGroup->addAction(modeEdit); bottom->addAction(modeEdit); bottom->addAction(setColor); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - QMenu *file_menu = menuBar()->addMenu("File"); openFile = new QAction(QIcon(":/book.png"), QString("Open.."), this); reLoad = new QAction(QIcon(":/reload1.png"), QString("reload"), this); connect(openFile, SIGNAL(triggered()), this, SLOT(OpenFile())); connect(reLoad, SIGNAL(triggered()), this, SLOT(DoReload())); file_menu->addAction(openFile); file_menu->addAction(reLoad); reLoad->setEnabled(false); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - QMenu *edit_menu = menuBar()->addMenu("Edit"); deleteSelected = new QAction(QString("delete"), this); deleteSelected->setShortcut(QKeySequence("Del")); cropSelected = new QAction(QString("crop"), this); pasteClipboard = new QAction(QIcon(":/win-paste.png"), QString("paste"), this); copyCLR = new QAction(QIcon(":/export-blue.png"), QString("copy"), this); copyBnW = new QAction(QIcon(":/export-mono.png"), QString("copy b/w"), this); newWin = new QAction(QIcon(":/windows1.png"), QString("new window"), this); bottom->addAction(pasteClipboard); pasteClipboard->setEnabled(false); //+ bottom->addAction(copyCLR); copyCLR->setShortcut(QKeySequence("Ctrl+C")); bottom->addAction(copyBnW); bottom->addAction(newWin); newWin->setEnabled(false); //+ connect(deleteSelected, SIGNAL(triggered()), this, SLOT(DeleteSelected())); connect( cropSelected, SIGNAL(triggered()), this, SLOT( CropSelected())); connect(pasteClipboard, SIGNAL(triggered()), this, SLOT(PasteClipboard())); connect(copyCLR, SIGNAL(triggered()), this, SLOT(CopyCLR())); connect(copyBnW, SIGNAL(triggered()), this, SLOT(CopyBnW())); connect(newWin, SIGNAL(triggered()), this, SLOT(NewWindow())); edit_menu->addAction(deleteSelected); edit_menu->addAction( cropSelected); edit_menu->addSeparator(); edit_menu->addAction(pasteClipboard); edit_menu->addAction(copyCLR); edit_menu->addAction(copyBnW); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - colorMenu = menuBar()->addMenu("Color"); #define ADD_colorMenu(ico,text,shortcut) \ colorMenu->addAction(*ico,text)->setShortcut(QKeySequence(shortcut)) ADD_colorMenu(enBlancoIco, "blanco", "B"); ADD_colorMenu(enRojoIco, "rojo (red)", "R"); ADD_colorMenu(enCastanoIco, Utf8("castaño (brown)"),"C"); ADD_colorMenu(enVerdeIco, "verde (green)", "V"); ADD_colorMenu(enAzulIco, "azul (blue)", "A"); colorMenu->addSeparator(); colorMenu->addAction("random Bicolor")->setShortcut(QKeySequence("Ctrl+B")); colorMenu->addAction("random Recolor")->setShortcut(QKeySequence("Ctrl+R")); colorMenu->addAction("Un-color all") ->setShortcut(QKeySequence("Ctrl+U")); connect(colorMenu, SIGNAL(triggered(QAction*)), this, SLOT(SelectColor(QAction*))); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - QLabel *magIcon = new QLabel; magIcon->setPixmap(QPixmap(":/zoom3.png")); magText = new QLabel(QString("+1")); magText->setAlignment(Qt::AlignRight|Qt::AlignVCenter); magText->setFont(fixedFont); magText->setMinimumSize(QSize(30,25)); bottom->addWidget(magText); bottom->addWidget(magIcon); fitView = new QAction(QIcon(":/full-size.png"), QString("fit"), this); connect(fitView, SIGNAL(triggered()), this, SLOT(DoFitView())); bottom->addAction(fitView); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - QMenu *play_menu = menuBar()->addMenu("Play"); playGen = new QLabel(QString("0")); playGen->setAlignment(Qt::AlignRight|Qt::AlignVCenter); playGen->setMinimumSize(QSize(66,25)); prevGen = new QAction(QIcon(":/step-back.png"), QString("back"), this); nextGen = new QAction(QIcon(":/go-forward.png") , QString("step"), this); playStop = new QAction(QIcon(":/fast-forward.png"), QString("go!"), this); connect(prevGen, SIGNAL(triggered()), this, SLOT(DoPrevGen())); connect(nextGen, SIGNAL(triggered()), this, SLOT(DoNextGen())); connect(playStop, SIGNAL(triggered()), this, SLOT(DoPlayStop())); play_menu->addAction(nextGen); play_menu->addAction(playStop); play_menu->addAction(prevGen); prevGen->setEnabled(false); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - speedSlider = new QSlider(Qt::Horizontal, this); speedSlider->setMinimum(1); speedSlider->setValue(speed); speedSlider->setMaximum(4); speedSlider->setMaximumSize(50,22); speedSlider->setSingleStep(1); speedSlider->setTickInterval(1); speedSlider->setTickPosition(QSlider::TicksBelow); connect(speedSlider, SIGNAL(valueChanged(int)), this, SLOT(ChangeSpeed(int))); bottom->addWidget(playGen); bottom->addAction(nextGen); bottom->addWidget(speedSlider); bottom->addAction(playStop); addToolBar(Qt::BottomToolBarArea, bottom); //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (fileToLoad) LoadTheWorld(fileToLoad); else SetWinTitle(); show(); raise(); }
// =============================================================================== // Reload the mesh if we should // This is usually called when a resource needs to be refreshed void OLMeshTracker::DoReload(Ogre::String meshName) { Ogre::MeshPtr meshP = (Ogre::MeshPtr)Ogre::MeshManager::getSingleton().getByName(meshName); if (!meshP.isNull()) { DoReload(meshP); } }
int CommodityClassMgr::DoReload(u_int32_t uiParentID, u_int32_t uiClassLevel, CommodityClassFullPath cCommodityClassFullPath, map<u_int32_t, map<u_int32_t, string> > &mapClassName) { if(mapClassName[uiParentID].size() == 0) return 0; for(map<u_int32_t, string>::iterator i = mapClassName[uiParentID].begin(); i != mapClassName[uiParentID].end(); i++) { u_int32_t uiClassID = i->first; string sClassName = i->second; CommodityClassFullPath cCurrentPath = cCommodityClassFullPath; cCurrentPath.m_uiClassLevel = uiClassLevel; switch(uiClassLevel) { case 1: cCurrentPath.m_uiClassIDL1 = uiClassID; break; case 2: cCurrentPath.m_uiClassIDL2 = uiClassID; break; case 3: cCurrentPath.m_uiClassIDL3 = uiClassID; break; case 4: cCurrentPath.m_uiClassIDL4 = uiClassID; break; case 5: cCurrentPath.m_uiClassIDL5 = uiClassID; break; default: BOSS_ERROR("类目级别最多为五级"); return -1; } if('\0' == cCurrentPath.m_sFullClassName[0]) { snprintf(cCurrentPath.m_sFullClassName, sizeof(cCurrentPath.m_sFullClassName), "%s", sClassName.c_str()); } else { strncat(cCurrentPath.m_sFullClassName, ">>", sizeof(cCurrentPath.m_sFullClassName) - strlen(cCurrentPath.m_sFullClassName) - 1); strncat(cCurrentPath.m_sFullClassName, sClassName.c_str(), sizeof(cCurrentPath.m_sFullClassName) - strlen(cCurrentPath.m_sFullClassName) - 1); } if(mapClassName.find(uiClassID) == mapClassName.end()) { cCurrentPath.m_uiLeafID = uiClassID; } if(SetCommodityClassFullPath(uiClassID, cCurrentPath) != 0) { BOSS_ERROR("保存类目ID为 %u的路径错误", uiClassID); return -1; } if(DoReload(uiClassID, uiClassLevel + 1, cCurrentPath, mapClassName) != 0) return -1; } return 0; }