Bool ApplinkDialog::InitValues(void) { if (!GeDialog::InitValues()) return FALSE; filenamePrefs = GeGetPluginPath()+ "preference.ini"; dirty = FALSE; AutoAlloc<HyperFile> hyperfilePrefs; if(!GeFExist(filenamePrefs, FALSE)) { if (!hyperfilePrefs->Open(filenamePrefs.GetString(), GE_WRITE, FILE_NODIALOG)) return FALSE; gPreferences.SetString(IDC_TMP_FOLDER, ""); Filename path; #ifdef _WIN32 || _WIN64 path = GeGetC4DPath(C4D_PATH_MYDOCUMENTS); #elif __APPLE__ path = GeGetC4DPath(C4D_PATH_HOME); #endif Filename exFolder = path + "3D-CoatV3" + "Exchange"; if(GeFExist(exFolder, TRUE)) { gPreferences.SetString(IDC_EXCH_FOLDER, exFolder.GetString()); } else { #ifdef _WIN32 || _WIN64 GePrint(String("Folder ..\\MyDocuments\\3D-CoatV3\\Exchange not found!")); #elif __APPLE__ GePrint(String("Folder ../Users/admin/3D-CoatV3/Exchange not found!")); #endif gPreferences.SetString(IDC_EXCH_FOLDER, ""); } gPreferences.SetLong(IDC_COMBO_MAP_TYPE, 0); gPreferences.SetBool(IDC_CHK_EXP_MAT, TRUE); gPreferences.SetBool(IDC_CHK_EXP_UV, TRUE); gPreferences.SetBool(IDC_CHK_SKIP_IMP_DIALOG, FALSE); gPreferences.SetBool(IDC_CHK_SKIP_EXP_DIALOG, FALSE); gPreferences.SetBool(IDC_CHK_IMP_MAT, TRUE); gPreferences.SetLong(IDC_COMBO_MAP_IMPORT, 0); gPreferences.SetBool(IDC_CHK_IMP_UV, TRUE); gPreferences.SetBool(IDC_CHK_REPLACE, TRUE); gPreferences.SetBool(IDC_CHK_PROMPT, FALSE); gPreferences.SetString(IDC_COAT_EXE_PATH, ""); gPreferences.SetBool(IDC_CHK_COAT_START, FALSE); hyperfilePrefs->WriteContainer(gPreferences); hyperfilePrefs->Close(); } if(!hyperfilePrefs->Open(filenamePrefs.GetString(), GE_READ, FILE_NODIALOG)) return FALSE; hyperfilePrefs->ReadContainer(&gPreferences, TRUE); hyperfilePrefs->Close(); SetString(IDC_TMP_FOLDER, gPreferences.GetString(IDC_TMP_FOLDER)); SetString(IDC_EXCH_FOLDER, gPreferences.GetString(IDC_EXCH_FOLDER)); SetLong(IDC_COMBO_MAP_TYPE, gPreferences.GetLong(IDC_COMBO_MAP_TYPE)); SetBool(IDC_CHK_EXP_MAT, gPreferences.GetBool(IDC_CHK_EXP_MAT)); SetBool(IDC_CHK_EXP_UV, gPreferences.GetBool(IDC_CHK_EXP_UV)); SetBool(IDC_CHK_SKIP_IMP_DIALOG, gPreferences.GetBool(IDC_CHK_SKIP_IMP_DIALOG)); SetBool(IDC_CHK_SKIP_EXP_DIALOG, gPreferences.GetBool(IDC_CHK_SKIP_EXP_DIALOG)); SetBool(IDC_CHK_IMP_MAT, gPreferences.GetBool(IDC_CHK_IMP_MAT)); SetLong(IDC_COMBO_MAP_IMPORT, gPreferences.GetLong(IDC_COMBO_MAP_IMPORT)); SetBool(IDC_CHK_IMP_UV, gPreferences.GetBool(IDC_CHK_IMP_UV)); SetBool(IDC_CHK_REPLACE, gPreferences.GetBool(IDC_CHK_REPLACE)); SetBool(IDC_CHK_PROMPT, gPreferences.GetBool(IDC_CHK_PROMPT)); SetString(IDC_COAT_EXE_PATH, gPreferences.GetString(IDC_COAT_EXE_PATH)); SetBool(IDC_CHK_COAT_START, gPreferences.GetBool(IDC_CHK_COAT_START)); #ifdef __APPLE__ //------------ temp Enable(IDC_CHK_COAT_START, false); Enable(IDC_COAT_EXE_PATH, false); //------------- // SetString(IDS_STATIC12, "Folder ../Users/user/3D-CoatV3/Exchange not found!"); #endif SetTimer(1000); return TRUE; }
Updatable::Updatable() { Enable(); }
void UpdateGadgets(Bool relevants=false) { Int32 mode; Bool add_dynamics; GetBool(CHK_ADDDYNAMICS, add_dynamics); GetInt32(CMB_MODE, mode); BaseDocument* doc = GetActiveDocument(); BaseObject* op = doc ? doc->GetActiveObject() : nullptr; Enable(EDT_MAXCONN, mode != CMB_MODE_CHAIN); Enable(EDT_RADIUS, mode != CMB_MODE_CHAIN); Enable(CHK_CLOSED, mode == CMB_MODE_CHAIN); Enable(CHK_COMPOUND, add_dynamics); // Need at least two child objects on the active object. Bool execEnabled = op != nullptr && op->GetDown() != nullptr && op->GetDown()->GetNext() != nullptr; Enable(BTN_EXECUTE, execEnabled); if (relevants) { FreeChildren(CMB_TYPE); Int32 pluginid; GetInt32(CMB_FORCE, pluginid); do { BaseObject* op = BaseObject::Alloc(pluginid); if (!op) break; AutoFree<BaseObject> free(op); AutoAlloc<Description> desc; if (!op->GetDescription(desc, DESCFLAGS_DESC_0)) break; BaseContainer temp; AutoAlloc<AtomArray> arr; const BaseContainer* param = desc->GetParameter(FORCE_TYPE, temp, arr); if (!param) break; const BaseContainer* cycle = param->GetContainerInstance(DESC_CYCLE); if (!cycle) break; const BaseContainer* icons = param->GetContainerInstance(DESC_CYCLEICONS); Int32 i = 0; Int32 last_id = -1; while (true) { Int32 id = cycle->GetIndexId(i++); if (id == NOTOK) break; Int32 icon = icons ? icons->GetInt32(id) : -1; String name = cycle->GetString(id); if (name.Content()) { if (icon > 0) name += "&i" + String::IntToString(icon); if (last_id < 0) last_id = id; AddChild(CMB_TYPE, id, name); } } SetInt32(CMB_TYPE, last_id); } while (0); LayoutChanged(CMB_TYPE); } }
/* ================ idTrigger_Hurt::Spawn Damages activator Can be turned on or off by using. ================ */ void idTrigger_Hurt::Spawn( void ) { spawnArgs.GetBool( "on", "1", on ); spawnArgs.GetFloat( "delay", "1.0", delay ); nextTime = gameLocal.time; Enable(); }
void Console::ToggleConsole() { Enable( !IsEnabled() ); }
~CFlowNode_MsgReceiver() { Enable(false); // This unregisters the listener }
void wxCheckedListCtrl::EnableAll(bool enable) { for (int i = 0; i < GetItemCount(); i++) Enable(i, enable); }
void Disable() { Enable( false ); }
void CAI_ScriptConditions::InputEnable( inputdata_t &inputdata ) { m_bLeaveAsleep = false; Enable(); }
void Scene_Shop::SetMode(int nmode) { mode = nmode; help_window->SetText(""); // Central panel switch (mode) { case BuySellLeave: case BuySellLeave2: empty_window->SetVisible(true); Enable(sell_window.get(), false); break; case Sell: empty_window->SetVisible(false); Enable(sell_window.get(), true); break; case Buy: case BuyHowMany: case SellHowMany: case Bought: case Sold: empty_window->SetVisible(false); Enable(sell_window.get(), false); break; } // Right-hand panels switch (mode) { case BuySellLeave: case BuySellLeave2: case Sell: party_window->SetVisible(false); status_window->SetVisible(false); gold_window->SetVisible(false); break; case Buy: case BuyHowMany: case SellHowMany: case Bought: case Sold: party_window->SetVisible(true); status_window->SetVisible(true); gold_window->SetVisible(true); break; } // Left-hand panels switch (mode) { case BuySellLeave: case BuySellLeave2: case Sell: Enable(buy_window.get(), false); Enable(number_window.get(), false); empty_window2->SetVisible(false); break; case Buy: buy_window->Refresh(); Enable(buy_window.get(), true); Enable(number_window.get(), false); empty_window2->SetVisible(false); break; case BuyHowMany: case SellHowMany: number_window.get()->Refresh(); Enable(buy_window.get(), false); Enable(number_window.get(), true); break; case Bought: case Sold: Enable(buy_window.get(), false); Enable(number_window.get(), false); empty_window2->SetVisible(true); timer = DEFAULT_FPS; break; } shop_window->SetMode(mode); }
// \brief Load the config file (sounds.xml) for nav sounds bool CGUIAudioManager::Load() { CSingleLock lock(m_cs); UnLoad(); m_strMediaDir = GetSoundSkinPath(); if (m_strMediaDir.empty()) return true; Enable(true); std::string strSoundsXml = URIUtils::AddFileToFolder(m_strMediaDir, "sounds.xml"); // Load our xml file CXBMCTinyXML xmlDoc; CLog::Log(LOGINFO, "Loading %s", strSoundsXml.c_str()); // Load the config file if (!xmlDoc.LoadFile(strSoundsXml)) { CLog::Log(LOGNOTICE, "%s, Line %d\n%s", strSoundsXml.c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc()); return false; } TiXmlElement* pRoot = xmlDoc.RootElement(); std::string strValue = pRoot->Value(); if ( strValue != "sounds") { CLog::Log(LOGNOTICE, "%s Doesn't contain <sounds>", strSoundsXml.c_str()); return false; } // Load sounds for actions TiXmlElement* pActions = pRoot->FirstChildElement("actions"); if (pActions) { TiXmlNode* pAction = pActions->FirstChild("action"); while (pAction) { TiXmlNode* pIdNode = pAction->FirstChild("name"); unsigned int id = ACTION_NONE; // action identity if (pIdNode && pIdNode->FirstChild()) { CActionTranslator::TranslateString(pIdNode->FirstChild()->Value(), id); } TiXmlNode* pFileNode = pAction->FirstChild("file"); std::string strFile; if (pFileNode && pFileNode->FirstChild()) strFile += pFileNode->FirstChild()->Value(); if (id != ACTION_NONE && !strFile.empty()) { std::string filename = URIUtils::AddFileToFolder(m_strMediaDir, strFile); IAESound *sound = LoadSound(filename); if (sound) m_actionSoundMap.insert(std::pair<int, IAESound *>(id, sound)); } pAction = pAction->NextSibling(); } } // Load window specific sounds TiXmlElement* pWindows = pRoot->FirstChildElement("windows"); if (pWindows) { TiXmlNode* pWindow = pWindows->FirstChild("window"); while (pWindow) { int id = 0; TiXmlNode* pIdNode = pWindow->FirstChild("name"); if (pIdNode) { if (pIdNode->FirstChild()) id = CWindowTranslator::TranslateWindow(pIdNode->FirstChild()->Value()); } CWindowSounds sounds; sounds.initSound = LoadWindowSound(pWindow, "activate" ); sounds.deInitSound = LoadWindowSound(pWindow, "deactivate"); if (id > 0) m_windowSoundMap.insert(std::pair<int, CWindowSounds>(id, sounds)); pWindow = pWindow->NextSibling(); } } return true; }
static void OnEnableClicked(gcc_unused WndButton &Sender) { Enable(); }
//----------------------------------------------------------------------------- // Purpose: Input hander that starts the spawner //----------------------------------------------------------------------------- void CMomentaryRotButton::InputEnable( inputdata_t &inputdata ) { Enable(); }
//------------------------------------------------------------------------------------------- // McoStatus LogoWin2::DoEvents(short item, Point clickPoint, WindowCode *wc, int32 *numwc, void **data, Boolean &changed) { EventRecord event; WindowPtr window; short thePart; Rect screenRect, updateRect; Point aPoint = {100, 100}; Boolean QuitFlag = FALSE; McoStatus status; Window_Events code2; Changed = FALSE; *numwc = 0; status = MCO_SUCCESS; if (TickCount() - tick_start > 100) tick_start = 0; if (item == TIMER_ITEM) // close the window { *numwc = 1; wc[0].code = WE_Close_Window; wc[0].wintype = WinType; wc[0].winnum = WinNum; wc[0].doc = 0L; } if (item == ids[QD3D_Zoom]) { Enable(dp,Current_Button); Disable(dp,ids[QD3D_Zoom]); Current_Button = item; } else if (item == ids[QD3D_Rotate]) { Enable(dp,Current_Button); Disable(dp,ids[QD3D_Rotate]); Current_Button = item; } else if (item == ids[QD3D_Translate]) { Enable(dp,Current_Button); Disable(dp,ids[QD3D_Translate]); Current_Button = item; } else if (item == ids[QD3D_Info]) { Enable(dp,Current_Button); Disable(dp,ids[QD3D_Info]); Current_Button = item; } else if (item == ids[QD3D_Box]) { if (Current_Button == ids[QD3D_Rotate]) { code2 = WE_Rotate; } else if (Current_Button == ids[QD3D_Zoom]) { code2 = WE_Scale; } else if (Current_Button == ids[QD3D_Translate]) { code2 = WE_Translate; } else if (Current_Button == ids[QD3D_Info]) { status = get3Dinfo(clickPoint); } ProcessMouseDown(clickPoint,code2); } return status; }
bool wxGenericProgressDialog::Create( const wxString& title, const wxString& message, int maximum, wxWindow *parent, int style ) { SetTopParent(parent); m_parentTop = wxGetTopLevelParent(parent); m_pdStyle = style; wxWindow* const realParent = GetParentForModalDialog(parent, GetWindowStyle()); if (!wxDialog::Create(realParent, wxID_ANY, title)) return false; SetMaximum(maximum); // We need a running event loop in order to update the dialog and be able // to process clicks on its buttons, so ensure that there is one running // even if this means we have to start it ourselves (this happens most // commonly during the program initialization, e.g. for the progress // dialogs shown from overridden wxApp::OnInit()). if ( !wxEventLoopBase::GetActive() ) { m_tempEventLoop = new wxEventLoop; wxEventLoop::SetActive(m_tempEventLoop); } #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) // we have to remove the "Close" button from the title bar then as it is // confusing to have it - it doesn't work anyhow // // FIXME: should probably have a (extended?) window style for this if ( !HasPDFlag(wxPD_CAN_ABORT) ) { EnableCloseButton(false); } #endif // wxMSW #if defined(__SMARTPHONE__) SetLeftMenu(); #endif m_state = HasPDFlag(wxPD_CAN_ABORT) ? Continue : Uncancelable; // top-level sizerTop wxSizer * const sizerTop = new wxBoxSizer(wxVERTICAL); m_msg = new wxStaticText(this, wxID_ANY, message); sizerTop->Add(m_msg, 0, wxLEFT | wxTOP, 2*LAYOUT_MARGIN); int gauge_style = wxGA_HORIZONTAL; if ( style & wxPD_SMOOTH ) gauge_style |= wxGA_SMOOTH; #ifdef __WXMSW__ maximum /= m_factor; #endif m_gauge = new wxGauge ( this, wxID_ANY, maximum, wxDefaultPosition, // make the progress bar sufficiently long wxSize(wxMin(wxGetClientDisplayRect().width/3, 300), -1), gauge_style ); sizerTop->Add(m_gauge, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 2*LAYOUT_MARGIN); m_gauge->SetValue(0); // create the estimated/remaining/total time zones if requested m_elapsed = m_estimated = m_remaining = NULL; // also count how many labels we really have size_t nTimeLabels = 0; wxSizer * const sizerLabels = new wxFlexGridSizer(2); if ( style & wxPD_ELAPSED_TIME ) { nTimeLabels++; m_elapsed = CreateLabel(GetElapsedLabel(), sizerLabels); } if ( style & wxPD_ESTIMATED_TIME ) { nTimeLabels++; m_estimated = CreateLabel(GetEstimatedLabel(), sizerLabels); } if ( style & wxPD_REMAINING_TIME ) { nTimeLabels++; m_remaining = CreateLabel(GetRemainingLabel(), sizerLabels); } sizerTop->Add(sizerLabels, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, LAYOUT_MARGIN); #if defined(__SMARTPHONE__) if ( HasPDFlag(wxPD_CAN_SKIP) ) SetRightMenu(wxID_SKIP, _("Skip")); if ( HasPDFlag(wxPD_CAN_ABORT) ) SetLeftMenu(wxID_CANCEL); #else m_btnAbort = m_btnSkip = NULL; wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL); // Windows dialogs usually have buttons in the lower right corner const int sizerFlags = #if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXOSX__) wxALIGN_RIGHT | wxALL #else // !MSW wxALIGN_CENTER_HORIZONTAL | wxBOTTOM | wxTOP #endif // MSW/!MSW ; if ( HasPDFlag(wxPD_CAN_SKIP) ) { m_btnSkip = new wxButton(this, wxID_SKIP, _("&Skip")); buttonSizer->Add(m_btnSkip, 0, sizerFlags, LAYOUT_MARGIN); } if ( HasPDFlag(wxPD_CAN_ABORT) ) { m_btnAbort = new wxButton(this, wxID_CANCEL); buttonSizer->Add(m_btnAbort, 0, sizerFlags, LAYOUT_MARGIN); } if ( !HasPDFlag(wxPD_CAN_SKIP | wxPD_CAN_ABORT) ) buttonSizer->AddSpacer(LAYOUT_MARGIN); sizerTop->Add(buttonSizer, 0, sizerFlags, LAYOUT_MARGIN ); #endif // __SMARTPHONE__/!__SMARTPHONE__ SetSizerAndFit(sizerTop); Centre(wxCENTER_FRAME | wxBOTH); DisableOtherWindows(); Show(); Enable(); // this one can be initialized even if the others are unknown for now // // NB: do it after calling Layout() to keep the labels correctly aligned if ( m_elapsed ) { SetTimeLabel(0, m_elapsed); } Update(); return true; }
NCDialog::NCDialog( bool asChild, int nId, NCDialogParent* parent, const unicode_t* headerText, ButtonDataNode* blist ) //, unsigned bcolor, unsigned fcolor) : OperThreadWin( asChild ? Win::WT_CHILD : WT_MAIN /*WT_POPUP*/, 0, nId, parent ), //, &crect(0,0,300,100)), _shadow( parent ), // _fcolor(fcolor), // _bcolor(bcolor), _header( nId, this, headerText ), _lo( 9, 9 ), _buttonLo( 3, 16 ), _headerLo( 3, 3 ), _parentLo( 3, 3 ), enterCmd( 0 ), m_nId( nId ) { Enable(); _lo.SetLineGrowth( 4 ); _lo.SetColGrowth( 4 ); _lo.ColSet( 0, 2 ); _lo.ColSet( 1, 10 ); _lo.ColSet( 2, 3 ); _lo.ColSet( 3, 5 ); _lo.ColSet( 5, 5 ); _lo.ColSet( 6, 3 ); _lo.ColSet( 7, 10 ); _lo.ColSet( 8, 2 ); _lo.LineSet( 0, 2 ); _lo.LineSet( 1, 10 ); _lo.LineSet( 2, 3 ); _lo.LineSet( 3, 3 ); //_lo.LineSet(5, 5); _lo.LineSet( 6, 3 ); _lo.LineSet( 7, 5 ); _lo.LineSet( 8, 2 ); _lo.ColSet( 4, 16, 100000 ); _lo.LineSet( 4, 16, 100000 ); _lo.AddRect( &_borderRect, 0, 0, 8, 8 ); _lo.AddRect( &_frameRect, 2, 2, 6, 6 ); _headerLo.ColSet( 0, 1, 1000 ); _headerLo.ColSet( 2, 1, 1000 ); _headerLo.LineSet( 0, 2 ); _headerLo.LineSet( 2, 2 ); _headerLo.AddWin( &_header, 1, 1 ); _lo.AddLayout( &_headerLo, 1, 4 ); _buttonLo.ColSet( 0, 10, 1000 ); _buttonLo.ColSet( 15, 10, 1000 ); _buttonLo.LineSet( 0, 2 ); _buttonLo.LineSet( 2, 2 ); _parentLo.ColSet( 0, 20, 1000 ); _parentLo.ColSet( 2, 20, 1000 ); _parentLo.LineSet( 0, 20, 1000 ); _parentLo.LineSet( 2, 20, 1000 ); _parentLo.AddWin( this, 1, 1 ); _parentLo.SetLineGrowth( 0 ); _parentLo.SetLineGrowth( 2 ); _parentLo.SetColGrowth( 0 ); _parentLo.SetColGrowth( 2 ); if ( blist ) { int n = 0; int minW = 0; for ( ; blist->utf8text && n < 7; blist++, n++ ) { clPtr<Button> p = new Button( 0, this, utf8_to_unicode( _LT( carray_cat<char>( "DB>", blist->utf8text ).data(), blist->utf8text ) ).data(), blist->cmd ); p->Show(); p->Enable(); if ( n > 0 ) { _buttonLo.ColSet( n * 2, 5 ); } _buttonLo.AddWin( p.ptr(), 1, n * 2 + 1 ); if ( minW < p->GetLSize().x.minimal ) { minW = p->GetLSize().x.minimal; } _bList.append( p ); //break; ??? } if ( minW > 0 ) for ( int i = 0; i < _bList.count(); i++ ) { LSize s = _bList[i]->GetLSize(); s.x.minimal = s.x.maximal = minW; _bList[i]->SetLSize( s ); }; if ( _bList.count() ) { _bList[0]->SetFocus(); } } _lo.AddLayout( &_buttonLo, 5, 4 ); _header.Enable(); _header.Show(); SetLayout( &_lo ); if ( Type() == WT_CHILD && parent ) { parent->AddLayout( &_parentLo ); } SetPosition(); SetName( appName ); }
static BOOL CmdTrackType(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request) { struct SiS900Unit *unit; struct Opener *opener; ULONG packet_type, wire_error=0; struct TypeTracker *tracker; struct TypeStats *initial_stats; BYTE error = 0; unit = (APTR)request->ios2_Req.io_Unit; D(bug("[%s]: S2CmdTrackType()\n", unit->sis900u_name)); packet_type = request->ios2_PacketType; /* Get global tracker */ tracker = (struct TypeTracker *) FindTypeStats(LIBBASE, unit, &unit->sis900u_type_trackers, packet_type); if(tracker != NULL) tracker->user_count++; else { tracker = AllocMem(sizeof(struct TypeTracker), MEMF_PUBLIC|MEMF_CLEAR); if(tracker != NULL) { tracker->packet_type = packet_type; tracker->user_count = 1; Disable(); AddTail((APTR)&unit->sis900u_type_trackers, (APTR)tracker); Enable(); } } /* Store initial figures for this opener */ opener = request->ios2_BufferManagement; initial_stats = FindTypeStats(LIBBASE, unit, &opener->initial_stats, packet_type); if(initial_stats != NULL) { error = S2ERR_BAD_STATE; wire_error = S2WERR_ALREADY_TRACKED; } if(error == 0) { initial_stats = AllocMem(sizeof(struct TypeStats), MEMF_PUBLIC); if(initial_stats == NULL) { error = S2ERR_NO_RESOURCES; wire_error = S2WERR_GENERIC_ERROR; } } if(error == 0) { CopyMem(tracker, initial_stats, sizeof(struct TypeStats)); AddTail((APTR)&opener->initial_stats, (APTR)initial_stats); } /* Return */ request->ios2_Req.io_Error = error; request->ios2_WireError = wire_error; return TRUE; }
GL_APICALL void GL_APIENTRY glEnable (GLenum cap) { CONTEXT_EXEC(Enable(cap)); }
suic::Rect ScrollBar::GetScrollThumbRect(const suic::Size & size, bool bThumb) { int iMin = 0; int nxHScroll = (int)_decreaseBtn.GetWidth(); int nxVScroll = (int)_decreaseBtn.GetHeight(); suic::Rect rectThumb; if (bThumb || !_rcTrack.Empty()) { rectThumb = _rcTrack; } else { suic::Rect rect(0, 0, size.cx, size.cy); rectThumb = rect; int nClientSize = 0; int nThumbSize = 0; if (GetOrientation() == CoreFlags::Horizontal) { nThumbSize = nxHScroll; if (_decreaseBtn.IsVisible()) { rectThumb.left += nThumbSize; } if (_increaseBtn.IsVisible()) { rectThumb.right -= nThumbSize; } nClientSize = rectThumb.Width(); } else { nThumbSize = nxVScroll; if (_decreaseBtn.IsVisible()) { rectThumb.top += nThumbSize; } if (_increaseBtn.IsVisible()) { rectThumb.bottom -= nThumbSize; } nClientSize = rectThumb.Height(); } if (nClientSize <= cst_ScrollMin) { rectThumb.SetEmpty(); return rectThumb; } int nThumbPos = 0;//nThumbSize; if (_scroInfo.iPage != 0) { nThumbSize = max (::MulDiv(nClientSize, _scroInfo.iPage, _scroInfo.iMax - iMin + 1), cst_ScrollThumbMin); } if (nClientSize < nThumbSize || nThumbSize == 0) { rectThumb.SetEmpty (); Enable(!rectThumb.Empty()); return rectThumb; } else { nClientSize -= nThumbSize; int nMax = _scroInfo.iMax - max (_scroInfo.iPage - 1, 0); if (iMin < nMax) { nThumbPos += ::MulDiv(nClientSize, _scroInfo.iVisualPos - iMin, nMax - iMin); } } if (GetOrientation() == CoreFlags::Horizontal) { rectThumb.left = rect.left + nThumbPos + (_decreaseBtn.IsVisible() ? (int)_decreaseBtn.GetWidth() : 0); rectThumb.right = rectThumb.left + nThumbSize; } else { rectThumb.top = rect.top + nThumbPos + (_decreaseBtn.IsVisible() ? (int)_decreaseBtn.GetHeight() : 0); rectThumb.bottom = rectThumb.top + nThumbSize; } Enable(!rectThumb.Empty()); } return rectThumb; }
void CRemoteTreeView::SetDirectoryListing(const CSharedPointer<const CDirectoryListing> &pListing, bool modified) { m_busy = true; if (!pListing) { m_ExpandAfterList = wxTreeItemId(); DeleteAllItems(); AddRoot(_T("")); m_busy = false; if (FindFocus() == this) { wxNavigationKeyEvent evt; evt.SetFromTab(true); evt.SetEventObject(this); evt.SetDirection(true); AddPendingEvent(evt); } Enable(false); m_contextMenuItem = wxTreeItemId(); return; } Enable(true); if (pListing->m_hasUnsureEntries && !(pListing->m_hasUnsureEntries & ~(CDirectoryListing::unsure_unknown | CDirectoryListing::unsure_file_mask))) { // Just files changed, does not affect directory tree m_busy = false; return; } #ifndef __WXMSW__ Freeze(); #endif wxTreeItemId parent = MakeParent(pListing->path, !modified); if (!parent) { m_busy = false; #ifndef __WXMSW__ Thaw(); #endif return; } if (!IsExpanded(parent) && parent != m_ExpandAfterList) { DeleteChildren(parent); CFilterManager filter; if (HasSubdirs(*pListing, filter)) AppendItem(parent, _T(""), -1, -1); } else { RefreshItem(parent, *pListing, !modified); if (m_ExpandAfterList == parent) { #ifndef __WXMSW__ // Prevent CalculatePositions from being called wxGenericTreeItem *anchor = m_anchor; m_anchor = 0; #endif Expand(parent); #ifndef __WXMSW__ m_anchor = anchor; #endif } } m_ExpandAfterList = wxTreeItemId(); SetItemImages(parent, false); #ifndef __WXMSW__ m_freezeCount--; #endif if (!modified) SafeSelectItem(parent); #ifndef __WXMSW__ else Refresh(); #endif m_busy = false; }
/* ================ idTrigger::Event_Enable ================ */ void idTrigger::Event_Enable( void ) { Enable(); }
wxProgressDialog::wxProgressDialog(const wxString& title, const wxString& message, int maximum, wxWindow *parent, int style) : wxDialog(GetParentForModalDialog(parent), wxID_ANY, title), m_skip(false), m_delay(3), m_hasAbortButton(false), m_hasSkipButton(false) { // we may disappear at any moment, let the others know about it SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT); m_windowStyle |= style; m_hasAbortButton = (style & wxPD_CAN_ABORT) != 0; m_hasSkipButton = (style & wxPD_CAN_SKIP) != 0; #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) // we have to remove the "Close" button from the title bar then as it is // confusing to have it - it doesn't work anyhow // // FIXME: should probably have a (extended?) window style for this if ( !m_hasAbortButton ) { EnableCloseButton(false); } #endif // wxMSW #if defined(__SMARTPHONE__) SetLeftMenu(); #endif m_state = m_hasAbortButton ? Continue : Uncancelable; m_maximum = maximum; #if defined(__WXMSW__) || defined(__WXPM__) // we can't have values > 65,536 in the progress control under Windows, so // scale everything down m_factor = m_maximum / 65536 + 1; m_maximum /= m_factor; #endif // __WXMSW__ m_parentTop = wxGetTopLevelParent(parent); wxClientDC dc(this); dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); wxCoord widthText = 0; dc.GetTextExtent(message, &widthText, NULL, NULL, NULL, NULL); // top-level sizerTop wxSizer * const sizerTop = new wxBoxSizer(wxVERTICAL); m_msg = new wxStaticText(this, wxID_ANY, message); sizerTop->Add(m_msg, 0, wxLEFT | wxTOP, 2*LAYOUT_MARGIN); if ( maximum > 0 ) { int gauge_style = wxGA_HORIZONTAL; if ( style & wxPD_SMOOTH ) gauge_style |= wxGA_SMOOTH; m_gauge = new wxGauge ( this, wxID_ANY, m_maximum, wxDefaultPosition, // make the progress bar sufficiently long wxSize(wxMin(wxGetClientDisplayRect().width/3, 300), -1), gauge_style ); sizerTop->Add(m_gauge, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 2*LAYOUT_MARGIN); m_gauge->SetValue(0); } else { m_gauge = NULL; } // create the estimated/remaining/total time zones if requested m_elapsed = m_estimated = m_remaining = NULL; m_display_estimated = m_last_timeupdate = m_break = 0; m_ctdelay = 0; // also count how many labels we really have size_t nTimeLabels = 0; wxSizer * const sizerLabels = new wxFlexGridSizer(2); if ( style & wxPD_ELAPSED_TIME ) { nTimeLabels++; m_elapsed = CreateLabel(_("Elapsed time:"), sizerLabels); } if ( style & wxPD_ESTIMATED_TIME ) { nTimeLabels++; m_estimated = CreateLabel(_("Estimated time:"), sizerLabels); } if ( style & wxPD_REMAINING_TIME ) { nTimeLabels++; m_remaining = CreateLabel(_("Remaining time:"), sizerLabels); } sizerTop->Add(sizerLabels, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, LAYOUT_MARGIN); if ( nTimeLabels > 0 ) { // set it to the current time m_timeStart = wxGetCurrentTime(); } #if defined(__SMARTPHONE__) if ( m_hasSkipButton ) SetRightMenu(wxID_SKIP, _("Skip")); if ( m_hasAbortButton ) SetLeftMenu(wxID_CANCEL); #else m_btnAbort = m_btnSkip = NULL; wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL); // Windows dialogs usually have buttons in the lower right corner const int sizerFlags = #if defined(__WXMSW__) || defined(__WXPM__) wxALIGN_RIGHT | wxALL #else // !MSW wxALIGN_CENTER_HORIZONTAL | wxBOTTOM | wxTOP #endif // MSW/!MSW ; if ( m_hasSkipButton ) { m_btnSkip = new wxButton(this, wxID_SKIP, _("&Skip")); buttonSizer->Add(m_btnSkip, 0, sizerFlags, LAYOUT_MARGIN); } if ( m_hasAbortButton ) { m_btnAbort = new wxButton(this, wxID_CANCEL); buttonSizer->Add(m_btnAbort, 0, sizerFlags, LAYOUT_MARGIN); } sizerTop->Add(buttonSizer, 0, sizerFlags, LAYOUT_MARGIN ); #endif // __SMARTPHONE__/!__SMARTPHONE__ SetSizerAndFit(sizerTop); Centre(wxCENTER_FRAME | wxBOTH); if ( style & wxPD_APP_MODAL ) { m_winDisabler = new wxWindowDisabler(this); } else { if ( m_parentTop ) m_parentTop->Disable(); m_winDisabler = NULL; } Show(); Enable(); // this one can be initialized even if the others are unknown for now // // NB: do it after calling Layout() to keep the labels correctly aligned if ( m_elapsed ) { SetTimeLabel(0, m_elapsed); } Update(); }
bool Console::GetSpecialInputDown( int key ) { if( !IsEnabled() ) return false; if( key == GLFW_KEY_ESC || key == GetToggleConsoleKey() ) { Enable(false); } else if( key == GLFW_KEY_ENTER ) { AcceptCurrentInput(); _autoCompleteList.clear(); } else if( key == GLFW_KEY_TAB ) { AcceptAutocomplete(); } else if( key == GLFW_KEY_DEL ) { if (_cursorPos < _currentInput.length()) { String oldInput = _currentInput; _currentInput = oldInput.substr( 0, _cursorPos ); _currentInput += oldInput.substr(_cursorPos+1, oldInput.length()); RefreshAutoCompletes(); } } else if( key == GLFW_KEY_BACKSPACE ) { if( _cursorPos > 0 ) { String oldInput = _currentInput; _currentInput = oldInput.substr( 0, _cursorPos-1 ); if (_cursorPos < oldInput.length()) { _currentInput += oldInput.substr(_cursorPos, oldInput.length()); } --_cursorPos; RefreshAutoCompletes(); } } else if( key == GLFW_KEY_UP ) { AdvanceInputHistory( -1 ); } else if( key == GLFW_KEY_DOWN ) { AdvanceInputHistory( 1 ); } else if( key == GLFW_KEY_RIGHT ) { if (_cursorPos < _currentInput.length()) { ++_cursorPos; } } else if( key == GLFW_KEY_LEFT ) { if (_cursorPos > 0) { --_cursorPos; } } else if( key == GLFW_KEY_END ) { _cursorPos = _currentInput.length(); } else if( key == GLFW_KEY_HOME ) { _cursorPos = 0; } //TODO: Restore //else if( key == GLFW_KEY_PAGEUP ) //{ // AdvanceConsoleLog(-1); //} //else if( key == GLFW_KEY_PAGEDOWN ) //{ // AdvanceConsoleLog(1); //} return true; }
bool wxMenu::HandleCommandUpdateStatus( wxMenuItem* item, wxWindow* senderWindow ) { int menuid = item ? item->GetId() : 0; wxUpdateUIEvent event(menuid); event.SetEventObject( this ); bool processed = false; // Try the menu's event handler { wxEvtHandler *handler = GetEventHandler(); if ( handler ) processed = handler->ProcessEvent(event); } // Try the window the menu was popped up from // (and up through the hierarchy) if ( !processed ) { wxWindow *win = GetWindow(); if ( win ) processed = win->HandleWindowEvent(event); } if ( !processed && senderWindow != NULL) { processed = senderWindow->HandleWindowEvent(event); } if ( processed ) { // if anything changed, update the changed attribute if (event.GetSetText()) SetLabel(menuid, event.GetText()); if (event.GetSetChecked()) Check(menuid, event.GetChecked()); if (event.GetSetEnabled()) Enable(menuid, event.GetEnabled()); } else { #if wxOSX_USE_CARBON // these two items are also managed by the Carbon Menu Manager, therefore we must // always reset them ourselves UInt32 cmd = 0; if ( menuid == wxApp::s_macExitMenuItemId ) { cmd = kHICommandQuit; } else if (menuid == wxApp::s_macPreferencesMenuItemId ) { cmd = kHICommandPreferences; } if ( cmd != 0 ) { if ( !item->IsEnabled() || wxDialog::OSXHasModalDialogsOpen() ) DisableMenuCommand( NULL , cmd ) ; else EnableMenuCommand( NULL , cmd ) ; } #endif } return processed; }
void fn00001000(int32 d0, byte * a0) { struct Eq_4 * a6_8 = *(struct Eq_4 **) 0x04; int32 d2_166 = d0; byte * a2_249 = a0; if (a6_8->w0014 < 0x24) { word32 * a0_505 = &globals->ptr2B88; word32 d0_508 = 0x0C; do { *a0_505 = 0x00; a0_505 = a0_505 + 0x01; d0_508 = d0_508 - 0x01; } while (d0_508 != 0x00); } *&globals->ptr2B88 = fp; *&globals->ptr2B8C = (struct Eq_4 **) a6_8; struct Eq_25 * d0_19 = FindTask(0x00); struct Eq_31 * d0_112 = OpenLibrary(0x12BC, 0x00); if (d0_112 != null) { int32 d4_460; *&globals->ptr2B90 = (struct Eq_31 **) d0_112; if (d0_19->ptr00AC == null) { d4_460 = 0x02; d2_166 = 0x08; } else { byte * a0_463 = a0; d4_460 = 0x03; do { if (*a0_517 == 0x20) d4_460 = DPB(d4_460, (word16) d4_460 + 0x01, 0); a0_463 = a0_517 + 0x01; byte * a0_517 = a0_463; } while (*a0_517 != 0x00); } int32 d0_105 = d4_460 << 0x02; int32 d0_107 = d0_105 + d2_166; int32 d3_110 = d0_107 + 0x11; int32 d1_111 = 0x00010001; d0_112 = AllocMem(d0_107 + 0x11, 0x00010001); if (d0_112 != null) { Eq_119 a6_162; struct Eq_67 * dwLoc14_159; word32 a0_164; d0_112->dw0000 = (word32) (d0_107 + 0x11); Eq_126 d4_123 = d4_460 - 0x01; d0_112[0x03] = (struct Eq_31) d4_123; d0_112[0x02] = (struct Eq_31) (d0_112 + 0x04 + d0_105 / 0x04); Mem131[0x00:word32] = 0x00; struct Eq_67 * d0_132 = d0_19->ptr00AC; d0_132->ptr0000 = d0_107 + 0x11; d0_132->dw000C = d4_123 - 0x01; d0_132->ptr0008 = (byte *) (&d0_132->ptr0010 + d0_105 / 0x0028); Mem150[0x00:word32] = 0x00; struct Eq_67 * d0_151 = d0_19->ptr00AC; if (d0_151 == null) { fn00001214(d0_19); *&globals->ptr2B94 = (struct Eq_67 **) d0_151; *&globals->ptr2B98 = (struct Eq_67 **) d0_151; Mem403[0x00:word32] = 0x00; dwLoc14_159 = d0_151; ui32 d0_406 = d0_151->dw0024; if (d0_406 != 0x00) Enable(); Supervisor(d0_132); d0_132->dw0004 = d0_406; d2_166 = 1005; if (d0_406 == 0x00) { fn0000127C(0x0014); return; } *&globals->dw2B9C = d0_406; *&globals->dw2BA0 = d0_406; *&globals->dw2BA4 = d0_406; d0_19->dw009C = d0_406; d0_19->dw00A0 = d0_406; word32 d0_432 = ((word32[]) 0x08)[d0_406]; if (d0_432 != 0x00) d0_19->dw00A4 = d0_432; a6_162 = *&globals->ptr2B8C; l000011F8: a0_164 = d0_19->dw003A; goto l00001202; }
/** * name: OnModulesLoaded * desc: initialize stuff, which require all standard modules to bee loaded * params: none * return: 0 **/ void OnModulesLoaded() { Enable(db_get_b(NULL, MODNAME, SET_ZODIAC_AVATARS, FALSE)); }
void CSlideShowPanel::AdvanceSlideShow(bool changeSlide, bool reload) { double xRatio, yRatio, ratio; TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData(); if (selData == NULL) return; if (reload) { m_bCurrentSlideIsDefault = false; selData->lastSlideShown = -1; } int numSlides = (int)selData->slideShowFileNames.size(); #if TESTALLDESCRIPTIONS // For testing numSlides = 0; #endif if (numSlides <= 0) { #if HIDEDEFAULTSLIDE if (!reload) { return; } wxRect r = GetRect(); wxBitmap backgroundBitmap = ((CSimpleTaskPanel*)GetParent())->GetBackgroundBmp().GetSubBitmap(r); wxWindowDC dc(this); dc.DrawBitmap(backgroundBitmap, 0, 0); // Force redraws if text unchanged; hide all if not in all-projects list m_description->Show(false); Enable( false ); if (!m_bGotAllProjectsList) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(pDoc); pDoc->rpc.get_all_projects_list(m_AllProjectsList); m_bGotAllProjectsList = true; } SetDescriptionText(); return; #else // HIDEDEFAULTSLIDE SetBackgroundColour(*wxBLACK); if (m_bCurrentSlideIsDefault) return; CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); m_SlideBitmap = *pSkinSimple->GetWorkunitAnimationImage()->GetBitmap(); if (m_SlideBitmap.Ok()) { m_bCurrentSlideIsDefault = true; } #endif // HIDEDEFAULTSLIDE } else { #if HIDEDEFAULTSLIDE m_description->Show(false); Enable( false ); #endif // HIDEDEFAULTSLIDE // TODO: Should we allow slide show to advance if task is not running? int newSlide = selData->lastSlideShown; if (selData->dotColor == runningIcon) { // Advance only if running if (changeSlide) { if (++newSlide >= numSlides) { newSlide = 0; } } } if (newSlide < 0) { newSlide = 0; } if (selData->lastSlideShown != newSlide) { // Don't update if only one slide selData->lastSlideShown = newSlide; wxBitmap *bm = new wxBitmap(); bm->LoadFile(selData->slideShowFileNames[newSlide], wxBITMAP_TYPE_ANY); if (bm->Ok()) { m_SlideBitmap = *bm; delete bm; m_bCurrentSlideIsDefault = false; } } } if (m_SlideBitmap.Ok()) { // Check to see if they need to be rescaled to fit in the window ratio = 1.0; xRatio = (double)SLIDESHOWWIDTH / (double)m_SlideBitmap.GetWidth(); yRatio = (double)SLIDESHOWHEIGHT / (double)m_SlideBitmap.GetHeight(); if ( xRatio < ratio ) { ratio = xRatio; } if ( yRatio < ratio ) { ratio = yRatio; } if ( ratio < 1.0 ) { wxImage img = m_SlideBitmap.ConvertToImage(); img.Rescale((int) (m_SlideBitmap.GetWidth()*ratio), (int) (m_SlideBitmap.GetHeight()*ratio)); wxBitmap *bm = new wxBitmap(img); m_SlideBitmap = *bm; delete bm; } Refresh(); } }
void Shooter::SetSpeed(double speed) { SetSetpoint(speed); Enable(); }
void CBaseMenuEdit::EnableEditDirectory(bool bEnable) { Enable(IDmenuEditDirectory,bEnable); }
int Dss1ToSip::NObjDss1::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { typedef Domain::NamedObject QMocSuperClass; _id = QMocSuperClass::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: Enable((*reinterpret_cast< bool(*)>(_a[1]))); break; case 1: AddInterface((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 2: DeleteInterface((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 3: Calls((*reinterpret_cast< DRI::ICmdOutput*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; case 4: Calls((*reinterpret_cast< DRI::ICmdOutput*(*)>(_a[1]))); break; case 5: Info((*reinterpret_cast< DRI::ICmdOutput*(*)>(_a[1]))); break; case 6: Stat((*reinterpret_cast< DRI::ICmdOutput*(*)>(_a[1]))); break; case 7: RestartStat(); break; case 8: CallsDetail((*reinterpret_cast< QString(*)>(_a[1]))); break; case 9: L2Statistic((*reinterpret_cast< DRI::ICmdOutput*(*)>(_a[1]))); break; case 10: ClearL2Statistic(); break; case 11: L3Statistic((*reinterpret_cast< DRI::ICmdOutput*(*)>(_a[1]))); break; case 12: ClearL3Statistic(); break; default: ; } _id -= 13; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = GetStateStr(); break; case 1: *reinterpret_cast< int*>(_v) = m_activationCount; break; case 2: *reinterpret_cast< QString*>(_v) = LastActivation(); break; case 3: *reinterpret_cast< QString*>(_v) = LastDeactivation(); break; case 4: *reinterpret_cast< QString*>(_v) = HardwareType(); break; case 5: *reinterpret_cast< int*>(_v) = SigInterface(); break; case 6: *reinterpret_cast< int*>(_v) = m_addressCompleteSize; break; case 7: *reinterpret_cast< bool*>(_v) = m_sendAlertingTone; break; case 8: *reinterpret_cast< bool*>(_v) = m_useSharpAsNumberComplete; break; case 9: *reinterpret_cast< bool*>(_v) = m_relAnonymCall; break; case 10: *reinterpret_cast< QString*>(_v) = AnonymCallingAddr(); break; case 11: *reinterpret_cast< bool*>(_v) = m_restartReq; break; case 12: *reinterpret_cast< bool*>(_v) = L2TraceInd(); break; case 13: *reinterpret_cast< int*>(_v) = m_waitAnswerTimeout; break; } _id -= 14; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 5: SigInterface(*reinterpret_cast< int*>(_v)); break; case 6: m_addressCompleteSize = *reinterpret_cast< int*>(_v); break; case 7: m_sendAlertingTone = *reinterpret_cast< bool*>(_v); break; case 8: m_useSharpAsNumberComplete = *reinterpret_cast< bool*>(_v); break; case 9: m_relAnonymCall = *reinterpret_cast< bool*>(_v); break; case 10: AnonymCallingAddr(*reinterpret_cast< QString*>(_v)); break; case 11: m_restartReq = *reinterpret_cast< bool*>(_v); break; case 12: L2TraceInd(*reinterpret_cast< bool*>(_v)); break; case 13: m_waitAnswerTimeout = *reinterpret_cast< int*>(_v); break; } _id -= 14; } else if (_c == QMetaObject::ResetProperty) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 14; } #endif // QT_NO_PROPERTIES return _id; }