/** * Combine LocalMinimizer::Minimize and LocalMinimizer::Minimize_noOpt */ int simanneal::LocalMinimizer::Minimize_hybrid() { const auto old_conv_crit = conv_crit; const auto old_conv_steps = conv_steps; const double switch_crit = 1e-1; int iters_noopt = 0; int iters = 0; while(iters_noopt < 20) { conv_crit = switch_crit; conv_steps = 10; iters += Minimize(false,iters); conv_crit = old_conv_crit; conv_steps = old_conv_steps; iters_noopt = Minimize_noOpt(switch_crit); } iters += Minimize(false,iters); return iters + iters_noopt; }
void ProgressWindow::MessageReceived(BMessage *message) { switch (message->what) { case kMsgShow: if (fRetrievedUpdate && IsHidden()) { Show(); Minimize(false); } fRetrievedShow = true; break; case kMsgProgressStatusUpdate: float percent; if (message->FindFloat("percent", &percent) == B_OK) fStatusBar->Update(percent - fStatusBar->CurrentValue()); const char *text; if (message->FindString("message", &text) == B_OK) fStatusBar->SetText(text); fRetrievedUpdate = true; if (fRetrievedShow && IsHidden()) { Show(); Minimize(false); } break; default: BWindow::MessageReceived(message); } }
void MAS::Window::Autorollup(bool a) { if (a) { extraFlags |= W_AUTOROLLUP; if (!HasFocus() && !(extraFlags & W_MINIMIZED)) { Minimize(); } } else { extraFlags &= ~W_AUTOROLLUP; if ((extraFlags & W_MINIMIZED)) { Minimize(); } } }
void MAS::Window::HandleEvent(MAS::Widget &obj, int msg, intptr_t arg1, intptr_t arg2) { Dialog::HandleEvent(obj, msg, arg1, arg2); if (msg == MSG_ACTIVATE) { if (obj == iconMin) { Minimize(); } else if (obj == iconMax) { Maximize(); } } else if (msg == MSG_DCLICK) { if (obj == bGrip || obj == textBack || obj == title) { if (TestFlag(D_RESIZABLE)) { if (extraFlags & W_MAXIMIZED) { PlaySample(Skin::SAMPLE_CLOSE); } else { PlaySample(Skin::SAMPLE_OPEN); } Maximize(); } } } else if (msg == MSG_CLOSE && obj == *clientArea) { Close(); } }
Vec3q PointSampler::operator()(const Vec2q &coord, const Vec2q &diff) const { Vec2q pos = (coord) * Vec2q(wMul, hMul); i32x4 x(pos.x), y(pos.y); uint mip = 0; { floatq min = Min(diff.x * wMul, diff.y * hMul); uint pixels = uint(Minimize(min)); mip = 0; while(pixels) { mip++; pixels >>= 1; } mip = Min(mip, tex->Mips() - 1); } const u8 *data = (u8 *)tex->DataPointer(mip); int pitch = mipPitch[mip]; x >>= mip; y >>= mip; x &= i32x4(wMask >> mip); y &= i32x4(hMask >> mip); x = x + x + x; y *= pitch; floatq r = floatq(data[x[0] + y[0] + 0], data[x[1] + y[1] + 0], data[x[2] + y[2] + 0], data[x[3] + y[3] + 0]); floatq g = floatq(data[x[0] + y[0] + 1], data[x[1] + y[1] + 1], data[x[2] + y[2] + 1], data[x[3] + y[3] + 1]); floatq b = floatq(data[x[0] + y[0] + 2], data[x[1] + y[1] + 2], data[x[2] + y[2] + 2], data[x[3] + y[3] + 2]); return Vec3q(r, g, b) * f32x4(1.0f / 255.0f); }
bool wxBlockDoubleSelection::DeselectBlock( const wxBlockDouble &block, bool combineNow) { //wxCHECK_MSG(!block.IsEmpty(), false, wxT("Invalid block") ); bool done = false; wxBlockDouble top, bottom, left, right; for (int n=0; n<int(m_blocks.GetCount()); n++) { if (m_blocks[n].Delete(block, top, bottom, left, right)) { done = true; m_blocks.RemoveAt(n); n = (n > 0) ? n - 1 : -1; if (!top.IsEmpty()) m_blocks.Add(top); if (!bottom.IsEmpty()) m_blocks.Add(bottom); if (!left.IsEmpty()) m_blocks.Add(left); if (!right.IsEmpty()) m_blocks.Add(right); } } if (combineNow) Minimize(); return done; }
int CharismaWindow::getprefs() { FILE *f; char s[200],param[200]; int d; char fname[B_PATH_NAME_LENGTH]; int r; float x,y; r=find_directory(B_COMMON_SETTINGS_DIRECTORY,0,true,fname,sizeof fname); if(r) return r; strcat(fname,"/"); strcat(fname,"Charisma_settings"); f=fopen(fname,"r"); if(!f)return -1; if(!fgets(s,sizeof s,f)) goto error; if(strcmp(s,"Charisma_settings\n")) goto error; if(!fgets(s,sizeof s,f)) goto error; if(!sscanf(s,"version=%d",&d)) goto error; if(!fgets(s,sizeof s,f)) goto error; if(!sscanf(s,"directory=%[^\n]",g_webdir)) goto error; if(!fgets(s,sizeof s,f)) goto error; if(!sscanf(s,"mode=%d",&d)) goto error; modemenu->Menu()->ItemAt(d)->SetMarked(true); if(!fgets(s,sizeof s,f)) goto error; if(!sscanf(s,"smart_refresh=%d",&d)) goto error; smartrefresh->Menu()->ItemAt(d)->SetMarked(true); if(!fgets(s,sizeof s,f)) goto error; if(!sscanf(s,"external_control=%s",param)) goto error; extcontrol_item->SetMarked(!strcmp(param,"yes")); if(!fgets(s,sizeof s,f)) goto error; if(!sscanf(s,"netpositive_autoset=%s",param)) goto error; netposautoset_item->SetMarked(!strcmp(param,"yes")); if(!fgets(s,sizeof s,f)) goto error; if(2!=sscanf(s,"position=%f,%f\n",&x,&y)) goto error; MoveTo(x,y); if(!fgets(s,sizeof s,f)) goto error; if(!sscanf(s,"minimized=%s",¶m)) goto error; if(!strcmp(param,"yes")) Minimize(true); fclose(f); update_proxy_settings(); return 0; error: fclose(f); update_proxy_settings(); return -1; }
void MAS::Window::MsgGotmouse() { Dialog::MsgGotmouse(); if ((extraFlags & W_AUTOROLLUP) && (extraFlags & W_MINIMIZED)) { Minimize(); UpdateWindowProperties(); } }
bool Integrator::minimize( const unsigned int upperbound, const unsigned int lowerbound ) { unsigned int simple = 0, quadratic = 0; Minimize( upperbound, simple, quadratic ); std::cout << "Minimizations: " << simple << " " << quadratic << " Bound: " << lowerbound << std::endl; return ( ( simple + quadratic ) < lowerbound ); }
void MAS::Window::MsgLostmouse() { Dialog::MsgLostmouse(); SetCursor(Skin::MOUSE_NORMAL); if ((extraFlags & W_AUTOROLLUP) && !(extraFlags & W_MINIMIZED)) { Minimize(); UpdateWindowProperties(); } MoveMouse(mouseObject, NULL); }
//************************************************************************ // Updates the screen //************************************************************************ bool CChatScreen::Update() { if(!CScreen::Update()) return false; if(CConfig::GetBoolSetting(SESSION_CLOSE)) { if(!CAppletManager::GetInstance()->GetLCDConnection()->IsForeground()) { if(!m_bCloseTimer && CConfig::GetIntSetting(SESSION_CLOSETIMER) != 0) { m_bCloseTimer = true; m_dwCloseTimer = GetTickCount(); } else if(CConfig::GetIntSetting(SESSION_CLOSETIMER) == 0 || GetTickCount() - m_dwCloseTimer >= CConfig::GetIntSetting(SESSION_CLOSETIMER)) { m_bCloseTimer = false; CAppletManager::GetInstance()->ActivateEventScreen(); return true; } } } if(m_bMaximizedTimer && m_dwMaximizedDuration != INFINITE) { if(m_dwMaximizedTimer + m_dwMaximizedDuration <= GetTickCount()) Minimize(); } if(m_eReplyState == REPLY_STATE_INPUT && !m_Input.IsInputActive()) SendCurrentMessage(); // Handle Typing notifications if(IsInputActive()) { if(m_Input.GetLastInputTime() + 10000 <= GetTickCount()) { if(m_bTyping) { m_bTyping = false; CAppletManager::GetInstance()->SendTypingNotification(m_hContact,0); } } else if(CConfig::GetBoolSetting(SESSION_SENDTYPING) && !m_bTyping) { m_bTyping = true; CAppletManager::GetInstance()->SendTypingNotification(m_hContact,1); } } else if(m_bTyping) { m_bTyping = false; CAppletManager::GetInstance()->SendTypingNotification(m_hContact,0); } return true; }
LRESULT CView::OnSysCommand(WPARAM wParam, LPARAM lParam) { // Maximize and Minimuze requests end up here if (wParam == SC_MINIMIZE) // User pressed minimize button { Minimize(); return 0L; } return FinalWindowProc(WM_SYSCOMMAND, wParam, lParam); }
//************************************************************************ // invalidates the message mode //************************************************************************ void CChatScreen::InvalidateMessageMode(tstring strError) { m_eReplyState = REPLY_STATE_FAILED; m_InfoText.SetText(strError); SetButtonBitmap(2,IDB_BACK); SetButtonBitmap(3,IDB_SEND); if(IsMaximized()) Minimize(); }
bool ApplicationWindow::QuitRequested() { if (fMinimizeOnClose) { if (!IsMinimized()) Minimize(true); } else { if (!IsHidden()) Hide(); } return false; }
status_t BSCWindow::_CaptureFinished() { printf("finished\n"); fCapturing = false; if (IsMinimized()) Minimize(false); fStartStopButton->SetEnabled(false); fStartStopButton->SetLabel("Start Recording"); return B_OK; }
void ModelNodeButton::mousePressEvent ( QGraphicsSceneMouseEvent * event ) { if (minimized == false) { this->minimized = true; img = QImage (":/Icons/ressources/list-add.png"); emit Minimize(); } else { this->minimized = false; img = QImage (":/Icons/ressources/list-remove.png"); emit Maximize(); } QGraphicsItem::mousePressEvent(event); }
bool wxBlockIntSelection::SelectBlock( const wxBlockInt &block, bool combineNow, wxArrayBlockInt *addedBlocks ) { wxCHECK_MSG(!block.IsEmpty(), false, wxT("Invalid block") ); //TestBlocks(); wxArrayBlockInt extraBlocks; wxArrayBlockInt *extra = &extraBlocks; if (addedBlocks != NULL) { addedBlocks->Clear(); extra = addedBlocks; } extra->Add(block); int n, count = m_blocks.GetCount(); wxBlockInt top, bottom, left, right; for (n=0; n<count; n++) { for (int k=0; k<int(extra->GetCount()); k++) { if (m_blocks[n].Combine(extra->Item(k), top, bottom, left, right)) { extra->RemoveAt(k); if (!top.IsEmpty()) extra->Add(top); if (!bottom.IsEmpty()) extra->Add(bottom); if (!left.IsEmpty()) extra->Add(left); if (!right.IsEmpty()) extra->Add(right); //DoMinimize( *extra ); n = -1; break; } } } if (extra->GetCount() > 0u) { WX_APPEND_ARRAY(m_blocks, *extra); if (combineNow) Minimize(); return true; } return false; }
BOOL CView::OnCommand(WPARAM wParam, LPARAM lParam) { // OnCommand responds to menu and and toolbar input UNREFERENCED_PARAMETER(lParam); switch(LOWORD(wParam)) { case IDM_MINTOTRAY: Minimize(); return TRUE; case IDM_FILE_EXIT: OnFileExit(); return TRUE; case IDM_HELP_ABOUT: OnAbout(); return TRUE; } return FALSE; }
void MainWindow::Quit() { slayer->options.wind_rect = Frame(); teamView->SaveState(&slayer->options.columnsState); // slayer->options.wind_minimized = minimized; // What follows is a really ugly hack to detect if the user closed // the window with close button, or if Application wants to close // all windows: BMessage *msg = CurrentMessage(); // this is null if called outside BMessageReceived loop // -> message from application if (slayer->docked && msg != NULL) Minimize(true); else BWindow::Quit(); }
status_t BSCWindow::_CaptureStarted() { fCapturing = true; Settings settings; if (settings.MinimizeOnRecording()) Minimize(true); fStatusBar->Reset(); fStartStopButton->SetLabel("Stop Recording"); return B_OK; }
void ObjectInstance::ComputeBBox() { BBox b = tree->GetBBox(); floatq x0(b.min.x); floatq x1(b.max.x); floatq y(b.min.y, b.min.y, b.max.y, b.max.y); floatq z(b.min.z, b.max.z, b.min.z, b.max.z); Vec3q p0( y * rotation[0].y + z * rotation[0].z, y * rotation[1].y + z * rotation[1].z, y * rotation[2].y + z * rotation[2].z); Vec3q p1( x1 * rotation[0].x + p0.x, x1 * rotation[1].x + p0.y, x1 * rotation[2].x + p0.z); p0.x += x0 * rotation[0].x; p0.y += x0 * rotation[1].x; p0.z += x0 * rotation[2].x; bbox = BBox(Minimize(VMin(p0, p1)) + translation, Maximize(VMax(p0, p1)) + translation); }
void clGUIWindow::Event_Timer( iGUIResponder* Source, float DeltaTime ) { if ( FRequestingClose ) { if ( IsMinimized() ) { SetRegionState( REGION_SHRINKING ); } if ( IsMaximized() ) { Minimize(); } } clGUIDialogWindow::Event_Timer( Source, DeltaTime ); }
status_t BSCWindow::_CaptureFinished() { fCapturing = false; fStartStopButton->SetEnabled(false); fStartStopButton->SetLabel("Start Recording"); SendNotices(kMsgGUIStopCapture); if (IsHidden()) Show(); if (IsMinimized()) Minimize(false); return B_OK; }
void BStatusWindow::CreateStatusItem(thread_id thread, StatusWindowState type) { AutoLock<BWindow> lock(this); BRect rect(Bounds()); if (BStatusView* lastView = fViewList.LastItem()) rect.top = lastView->Frame().bottom + 1; else { // This is the first status item, reset speed/estimated finish toggle. sShowSpeed = true; sLastEstimatedFinishSpeedToggleTime = system_time(); } rect.bottom = rect.top + kDefaultStatusViewHeight - 1; BStatusView* view = new BStatusView(rect, thread, type); // the BStatusView will resize itself if needed in its constructor ChildAt(0)->AddChild(view); fViewList.AddItem(view); ResizeTo(Bounds().Width(), view->Frame().bottom); // find out if the desktop is the active window // if the status window is the only thing to take over active state and // desktop was active to begin with, return focus back to desktop // when we are done bool desktopActive = false; { AutoLock<BLooper> lock(be_app); int32 count = be_app->CountWindows(); for (int32 index = 0; index < count; index++) { if (dynamic_cast<BDeskWindow*>(be_app->WindowAt(index)) && be_app->WindowAt(index)->IsActive()) { desktopActive = true; break; } } } if (IsHidden()) { fRetainDesktopFocus = desktopActive; Minimize(false); Show(); } else fRetainDesktopFocus &= desktopActive; }
status_t BSCWindow::_CaptureStarted() { fCapturing = true; Settings settings; if (settings.MinimizeOnRecording()) Minimize(true); fCardLayout->SetVisibleItem((int32)0); fStatusBar->Reset(); fStartStopButton->SetLabel("Stop Recording"); SendNotices(kMsgGUIStartCapture); return B_OK; }
void TopWindow::SerializePlacement(Stream& s, bool reminimize) { GuiLock __; int version = 0; s / version; Rect rect = GetRect(); s % overlapped % rect; bool mn = state == MINIMIZED; bool mx = state == MAXIMIZED; s.Pack(mn, mx); LLOG("TopWindow::SerializePlacement / " << (s.IsStoring() ? "write" : "read")); LLOG("minimized = " << mn << ", maximized = " << mx); LLOG("rect = " << rect << ", overlapped = " << overlapped); if(s.IsLoading()) { if(mn) rect = overlapped; Rect limit = GetVirtualWorkArea(); Rect fm = windowFrameMargin; if((fm.left|fm.right|fm.top|fm.bottom) == 0) fm = Rect(8, 32, 8, 8); limit.left += fm.left; limit.right -= fm.right; limit.top += fm.top; limit.bottom -= fm.bottom; Size sz = min(rect.Size(), limit.Size()); rect = RectC( minmax(rect.left, limit.left, limit.right - sz.cx), minmax(rect.top, limit.top, limit.bottom - sz.cy), sz.cx, sz.cy); state = OVERLAPPED; if(mn && reminimize) state = MINIMIZED; if(mx) state = MAXIMIZED; if(state == OVERLAPPED) SetRect(rect); if(IsOpen()) { if(state == MINIMIZED) Minimize(false); if(state == MAXIMIZED) Maximize(false); } } }
//************************************************************************ // deactivates the input mode //************************************************************************ void CChatScreen::DeactivateMessageMode() { m_Input.Reset(); m_Input.SetScrollbar(NULL); m_TextLog.SetScrollbar(&m_Scrollbar); m_TextLog.Show(1); m_InfoText.Show(0); m_Input.Show(0); m_Input.DeactivateInput(); m_eReplyState = REPLY_STATE_NONE; SetButtonBitmap(2,IDB_HISTORY); SetButtonBitmap(3,IDB_REPLY); if(IsMaximized()) Minimize(); }
status_t SeqPrefWin::SetConfiguration(const BMessage* config) { ArpASSERT( config ); bool minimized; if( config->FindBool( "f_minimized", &minimized ) != B_OK ) minimized = false; Minimize(minimized); BScreen s(this); if( !s.IsValid() ) return B_ERROR; BRect sf = s.Frame(); float l, t, r, b; if( config->FindFloat( "f_left", &l ) == B_OK && config->FindFloat( "f_top", &t ) == B_OK && config->FindFloat( "f_right", &r ) == B_OK && config->FindFloat( "f_bottom", &b ) == B_OK ) { BRect f( l * sf.Width(), t * sf.Height(), r * sf.Width(), b * sf.Height() ); MoveTo( f.LeftTop() ); ResizeTo( f.Width(), f.Height() ); } return B_OK; }
// // FUNCTION: InitInstance(HINSTANCE, int) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } else g_hwnd = hWnd; InitNotifyIconData(); Minimize();//add the icon UpdateWindow(hWnd); return TRUE; }
//************************************************************************ // activates the input mode //************************************************************************ void CChatScreen::ActivateMessageMode() { m_InfoText.Show(0); m_TextLog.Show(0); m_TextLog.SetScrollbar(NULL); m_Input.SetScrollbar(&m_Scrollbar); if(m_eReplyState != REPLY_STATE_FAILED) m_Input.Reset(); m_Input.Show(1); m_Input.ActivateInput(); m_eReplyState = REPLY_STATE_INPUT; SetButtonBitmap(2,IDB_BACK); SetButtonBitmap(3,IDB_SEND); if(CConfig::GetBoolSetting(SESSION_REPLY_MAXIMIZED)) Maximize(); else Minimize(); }