int main() { InitGraphics(); SetWindowTitle("CS106 Pathfinder"); cout << "This masterful piece of work is a graph extravaganza!" << endl << "The main attractions include a lovely visual presentation of the graph" << endl << "along with an implementation of Dijkstra's shortest path algorithm and" << endl << "the computation of a minimal spanning tree. Enjoy!" << endl; Graph graph; Map<coordT> nodeCor; string loc1, loc2, image; image = loadGraphFile(graph, nodeCor); drawMap(graph, nodeCor); while (true) { int choice = promptForChoice(); switch (choice) { case 1: graph.clear(); nodeCor.clear(); image = loadGraphFile(graph, nodeCor); drawMap(graph, nodeCor); break; case 2: cout << endl; loc1 = getLocName("Click on starting location... ", nodeCor); loc2 = getLocName("Click on ending location... ", nodeCor); displayMinPath(graph, nodeCor, loc1, loc2); break; case 3: InitGraphics(); DrawNamedPicture(image); drawVertices(nodeCor); displayMST(graph, nodeCor); break; case 4: displayDomSet(graph, nodeCor); break; case 5: exit(0); } } return (0); }
BOOL BaseButton::create_window(PCWSTR title,HWND parent,int xPos,int yPos,int Height,int Width) { SetClassName(WC_BUTTON); SetPos(xPos,yPos); SetSize(Width,Height); SetWindowClassCreate(FALSE); //CreateWndClass(sizeof(WNDCLASSEX),CS_HREDRAW|CS_VREDRAW,NULL,NULL,NULL,NULL,NULL,NULL,L"Button",NULL); //return Create(title,WS_CHILD|WS_VISIBLE|BS_MULTILINE|WS_TABSTOP|WS_GROUP,parent,WS_EX_OVERLAPPEDWINDOW,NULL); SetWindowTitle((wchar_t *)(title)); SetStyle(WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON&~WS_BORDER); SetStyleEx(NULL); SetHParent(parent); //SetMenu(NULL); BOOL created= Create(); //SetWNDPROC(); return created; //return TRUE; }
static void DoLayerOp( void * data ) { switch((long)data ) { case ENUMLAYER_CLEAR: InitializeLayers( LayerSystemDefaults, -1 ); break; case ENUMLAYER_SAVE: LayerPrefSave(); break; case ENUMLAYER_RELOAD: LayerPrefLoad(); break; } UpdateLayerDlg(); if( layoutLayerChanged ) { MainProc( mainW, wResize_e, NULL ); layoutLayerChanged = FALSE; changed = TRUE; SetWindowTitle(); } }
BOOL CImageViewerFrame::CusLoadImage( Bitmap *pBitmap ) { if (NULL == pBitmap) { return FALSE; } SAFEDELETE(m_pBitmap); m_pBitmap = pBitmap; m_pView->SetBitmap(m_pBitmap); m_iImageOrgWid = pBitmap->GetWidth(); m_iImageOrgHei = pBitmap->GetHeight(); SetWindowTitle(); static BOOL bIsFrist = TRUE; if (bIsFrist) { ShowWindow(SW_SHOWMAXIMIZED); bIsFrist = FALSE; } CRect rcBarWnd; m_pBar->GetWindowRect(&rcBarWnd); if ((int)m_iBarHei < rcBarWnd.Height()) { m_iBarHei = rcBarWnd.Height(); } m_pView->AjustWndSize(); m_pBar->AjustWndSize(); m_pView->Invalidate(TRUE); return TRUE; }
void NyqBench::OnOpen(wxCommandEvent & e) { if (mScript->IsModified() && !Validate()) { return; } wxFileDialog dlog(this, _("Load Nyquist script"), mPath.GetPath(), wxEmptyString, _("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"), wxFD_OPEN | wxRESIZE_BORDER); if (dlog.ShowModal() != wxID_OK) { return; } mPath = dlog.GetPath(); gPrefs->Write(wxT("NyqBench/Path"), mPath.GetFullPath()); LoadFile(); SetWindowTitle(); }
void App::Update(const delta_t dt, const delta_t elapsed) { mouse_info mi = GetMouse(); SetWindowTitle("firefly-demo v%d.%d (FPS: %.2lf)" " x-%d y-%d", FF_MAJOR_VERSION, FF_MINOR_VERSION, m_fpsAvg, mi.x, mi.y); if (GetKey(GLFW_KEY_LEFT)) { rotation[1] -= dt * degreesPerSec; } if (GetKey(GLFW_KEY_RIGHT)) { rotation[1] += dt * degreesPerSec; } if (GetKey(GLFW_KEY_UP)) { rotation[0] -= dt * degreesPerSec; } if (GetKey(GLFW_KEY_DOWN)) { rotation[0] += dt * degreesPerSec; } arcPos += circleSpeed * dt; rotation[1] += spinSpeed * dt; }
bool MyApp::Init(int argc, char* argv[]) { ///////////////////////////////////////////////////////////////////////////////// Ogre::LogManager* pkLog(NULL); Ogre::ArchiveManager* pkArchive(NULL); Ogre::ResourceGroupManager* pkGroupManager(NULL); pkLog = OGRE_NEW Ogre::LogManager; pkArchive = OGRE_NEW Ogre::ArchiveManager; pkArchive->addArchiveFactory(OGRE_NEW Ogre::FileSystemArchiveFactory); pkGroupManager = OGRE_NEW Ogre::ResourceGroupManager; #ifdef FV_SHIPPING Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../Data","FileSystem"); #else // FV_SHIPPING Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../Data","FileSystem"); #endif // !FV_SHIPPING ///////////////////////////////////////////////////////////////////////////////// new FvRobotCfg(); if(!FvRobotCfg::Instance().Init(argc, argv)) { goto ERR; } SetWindowSize(FvRobotCfg::Instance().GetWindowSizeWidth(), FvRobotCfg::Instance().GetWindowSizeHeight()); SetFramePeriod(FvRobotCfg::Instance().GetWindowFramePeriod()); SetTimerPeriod(FvRobotCfg::Instance().GetWindowTimerPeriod()); SetWindowTitle("RobotApp"); ///////////////////////////////////////////////////////////////////////////////// g_iShouldWriteToConsole = FvRobotCfg::Instance().GetShouldWriteToConsole(); ///////////////////////////////////////////////////////////////////////////////// { SYSTEMTIME nowTime; GetLocalTime(&nowTime); srand(nowTime.wMilliseconds); char logName[128] = {0}; sprintf(logName, "Robot_%04d%02d%02d_%02d%02d%02d_%05u.log", nowTime.wYear, nowTime.wMonth, nowTime.wDay, nowTime.wHour, nowTime.wMinute, rand()); m_pkMsgFile = new MessageFile(logName); m_pkMsgFile->OpenLog(FvRobotCfg::Instance().GetShouldWriteToLog()); FvDebugFilter::Instance().AddMessageCallback(m_pkMsgFile); } ///////////////////////////////////////////////////////////////////////////////// new FvLogicDllManager(); if(!FvLogicDllManager::Instance().LoadDll(LOGICDLLNAME)) { FV_ERROR_MSG( "main: Load dll(%s) failed.\n", LOGICDLLNAME); goto ERR; } ///////////////////////////////////////////////////////////////////////////////// new FvRobotMainApp(); new FvRobotSpaceDataManager(); FvRobotMainApp::Instance().SetFileLog(m_pkMsgFile); if(!FvRobotMainApp::Instance().Init(argc, argv)) goto ERR; return true; ///////////////////////////////////////////////////////////////////////////////// ERR: Clear(); return false; }
//////////////////////////////////////////////////////////////// GFX SYSTEM FUNCTIONS bool C_GFX2D::InitializeGFX( int w, int h, int c, bool FullScreen, string wincaption, CLog *pUSELOG) { pLog=pUSELOG; pLog->_Add("Init SDL GFX Subsystem..."); bSDLFailed=false; #ifdef __linux__ putenv("SDL_VIDEODRIVER=x11"); #endif SDL_InitSubSystem(SDL_INIT_VIDEO); bCreatedLog=false; bFullScreen =FullScreen; ScreenWidth =w; ScreenHeight=h; ScreenColors=c; VideoFlags = SDL_HWPALETTE|SDL_DOUBLEBUF; if(bFullScreen) VideoFlags |= SDL_FULLSCREEN; SDL_version ver; SDL_VERSION(&ver); pLog->_Add("SDL Version %d.%d.%d",ver.major,ver.minor,ver.patch); dlcsm_make_str(vdriver); SDL_VideoDriverName(vdriver,sizeof(vdriver)); pLog->_Add("Video driver[%s]",vdriver); VideoModes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); if(VideoModes == (SDL_Rect **)0){ } else { if(VideoModes == (SDL_Rect **)-1) pLog->_DebugAdd("All resolutions available"); else { pLog->_DebugAdd("Available Modes"); for(int i=0;VideoModes[i];++i) pLog->_DebugAdd(" %d x %d", VideoModes[i]->w, VideoModes[i]->h); } } const SDL_VideoInfo * VideoInfo = SDL_GetVideoInfo(); if(VideoInfo) { pLog->_DebugAdd("VideoInfo->hw_available [%d] ",VideoInfo->hw_available); pLog->_DebugAdd("VideoInfo->wm_available [%d] ",VideoInfo->wm_available); pLog->_DebugAdd("VideoInfo->blit_hw [%d] ",VideoInfo->blit_hw); pLog->_DebugAdd("VideoInfo->blit_hw_CC [%d] ",VideoInfo->blit_hw_CC); pLog->_DebugAdd("VideoInfo->blit_hw_A [%d] ",VideoInfo->blit_hw_A); pLog->_DebugAdd("VideoInfo->blit_sw [%d] ",VideoInfo->blit_sw); pLog->_DebugAdd("VideoInfo->blit_sw_CC [%d] ",VideoInfo->blit_sw_CC); pLog->_DebugAdd("VideoInfo->blit_sw_A [%d] ",VideoInfo->blit_sw_A); pLog->_DebugAdd("VideoInfo->blit_fill [%d] ",VideoInfo->blit_fill); pLog->_DebugAdd("VideoInfo->video_mem [%d] ",VideoInfo->video_mem); pLog->_DebugAdd("VideoInfo->vfmt->BitsPerPixel [%d] ",VideoInfo->vfmt->BitsPerPixel); pLog->_DebugAdd("VideoInfo->vfmt->BytesPerPixel [%d] ",VideoInfo->vfmt->BytesPerPixel); pLog->_DebugAdd("VideoInfo->vfmt->Rloss [%d] ",VideoInfo->vfmt->Rloss); pLog->_DebugAdd("VideoInfo->vfmt->Gloss [%d] ",VideoInfo->vfmt->Gloss); pLog->_DebugAdd("VideoInfo->vfmt->Bloss [%d] ",VideoInfo->vfmt->Bloss); pLog->_DebugAdd("VideoInfo->vfmt->Aloss [%d] ",VideoInfo->vfmt->Aloss); pLog->_DebugAdd("VideoInfo->vfmt->Rshift [%d] ",VideoInfo->vfmt->Rshift); pLog->_DebugAdd("VideoInfo->vfmt->Gshift [%d] ",VideoInfo->vfmt->Gshift); pLog->_DebugAdd("VideoInfo->vfmt->Bshift [%d] ",VideoInfo->vfmt->Bshift); pLog->_DebugAdd("VideoInfo->vfmt->Ashift [%d] ",VideoInfo->vfmt->Ashift); pLog->_DebugAdd("VideoInfo->vfmt->Rmask [%d] ",VideoInfo->vfmt->Rmask); pLog->_DebugAdd("VideoInfo->vfmt->Gmask [%d] ",VideoInfo->vfmt->Gmask); pLog->_DebugAdd("VideoInfo->vfmt->Bmask [%d] ",VideoInfo->vfmt->Bmask); pLog->_DebugAdd("VideoInfo->vfmt->Amask [%d] ",VideoInfo->vfmt->Amask); pLog->_DebugAdd("VideoInfo->vfmt->colorkey [%d] ",VideoInfo->vfmt->colorkey); pLog->_DebugAdd("VideoInfo->vfmt->alpha [%d] ",VideoInfo->vfmt->alpha); } else { bSDLFailed=true; pLog->_Add("Failed getting Video Info : %s",SDL_GetError()); return false; } if(VideoInfo->hw_available) { VideoFlags |= SDL_HWSURFACE; pLog->_Add("Hardware surfaces...");} else { VideoFlags |= SDL_SWSURFACE; pLog->_Add("Software surfaces..."); } if(VideoInfo->blit_hw) { VideoFlags |= SDL_HWACCEL; pLog->_Add("Hardware acceleration enabled!"); } if(SDL_VideoModeOK(ScreenWidth,ScreenHeight,ScreenColors,VideoFlags)) { } else { pLog->_Add("SDL_VideoModeOK failure"); return false; } pScreen=SDL_SetVideoMode(ScreenWidth,ScreenHeight,ScreenColors,VideoFlags); if(!pScreen) { bSDLFailed=true; pLog->_Add("SDL_SetVideoMode failed"); return false; } SDL_ShowCursor(SDL_DISABLE); SetWindowTitle(wincaption); pLog->_Add("SDL GFX Initialized"); return true; }
int main() { Set<nodeT *> graph; Map<nodeT *> graphMap; InitGraphics(); SetWindowTitle("Pathfinder"); string backgroundFile; bool timeToQuit = false; cout << "This masterful piece of work is a graph extravaganza!" << endl; while (true) { cout << "Your options are:" << endl; cout << "(1) Choose a new graph data file" << endl; cout << "(2) Find shortest path using Dijkstra's algorithm" << endl; cout << "(3) Compute the minimal spanning tree using Kruskal's algorithm" << endl; cout << "(4) Determine if the graph has cycles" << endl; cout << "(5) Quit" << endl; cout << "Enter choice: "; int choice = GetInteger(); string datafile; void UpdateDisplay(); switch (choice) { case 1: cout << "Enter the name of the data file: "; datafile = GetLine(); //datafile = "Small.txt"; //datafile = "USA.txt"; //datafile = "Stanford.txt"; graph.clear(); graphMap.clear(); backgroundFile = ReadGraph(graph, graphMap, datafile); break; case 2: if (backgroundFile == "") { cout << "No file is specified" << endl; } else { UpdateDisplay(); MovePen(0,0); DrawNamedPicture(backgroundFile); DrawNodesAndArcs(graph); cout << "(2) Finding shortest path using Dijkstra's algorithm" << endl; HandleShortestPath(graph); } break; case 3: if (backgroundFile == "") { cout << "No file is specified" << endl; } else { cout << "(3) Computing the minimal spanning tree using Kruskal's algorithm" << endl; UpdateDisplay(); MovePen(0,0); DrawNamedPicture(backgroundFile); //DrawNodesAndArcs(graph); minimumSpanningTree(graph, graphMap); } break; case 4: if (backgroundFile == "") { cout << "No file is specified" << endl; } else { graphT graph2; graph2.allNodes = graph; cout << "(4) Determining if the graph has cycles" << endl; if (IsCyclicGraph(graph2)) cout << "Yes, it is cyclic" << endl; else cout << "No, it is not cyclic" << endl; } break; case 5: cout << "Thanks for using Pathfinder. Bye!" << endl; timeToQuit = true; break; default: cout << "Invalid choice" << endl; break; } if (timeToQuit) break; } return (0); }
CMainWindow::CMainWindow(HINSTANCE hInst, const WNDCLASSEX* wcx /* = NULL*/) : CWindow(hInst, wcx) , m_bShowFindBar(false) { SetWindowTitle(_T("TortoiseUDiff")); }
CoordSearchDialog::CoordSearchDialog():m_targetObj(""),m_RA_TargetCoord(0),m_DEC_TargetCoord(0),m_downloadedFile(""){ pcl::Font fnt = Font(); int editWidth = fnt.Width(String('0', 8)); int searchEditWidth = fnt.Width(String('0', 15)); SetWindowTitle( "Online Search" ); Search_Sizer.SetSpacing(10); Search_Sizer.SetMargin(10); Search_Label.SetText( "Object: " ); Search_Label.SetToolTip( "<p>Search for object </p>" ); Search_Label.SetTextAlignment(TextAlign::Left | TextAlign::VertCenter); Search_Edit.SetMinWidth(searchEditWidth); Search_Edit.SetMaxWidth(70); Search_Edit.OnEditCompleted((Edit::edit_event_handler) &CoordSearchDialog::EditCompleted,*this); Search_PushButton.SetText( "Search" ); Search_PushButton.OnClick((Button::click_event_handler) &CoordSearchDialog::Button_Click,*this); Search_Sizer.Add(Search_Label); Search_Sizer.Add(Search_Edit); Search_Sizer.Add(Search_PushButton); Global_Sizer.Add(Search_Sizer); SearchResult_Sizer.SetSpacing(10); SearchResult_Sizer.SetMargin(10); TRA_Label.SetText( "Target RA:" ); TRA_Label.SetToolTip( "<p>Target right ascension position </p>" ); TRA_Label.SetTextAlignment(TextAlign::Left | TextAlign::VertCenter); TRA_Edit.SetMinWidth(editWidth); TRA_Edit.SetMaxWidth(70); TRA_Edit.SetText( "00:00:00" ); TRA_Edit.Disable(); TDEC_Label.SetText( "Target Dec:" ); TDEC_Label.SetToolTip( "<p>Target declination position </p>" ); TDEC_Label.SetTextAlignment(TextAlign::Left | TextAlign::VertCenter); TDEC_Edit.SetMinWidth(editWidth); TDEC_Edit.SetMaxWidth(70); TDEC_Edit.SetText( "00:00:00" ); TDEC_Edit.Disable(); SearchResult_Sizer.Add(TRA_Label); SearchResult_Sizer.Add(TRA_Edit); SearchResult_Sizer.Add(TDEC_Label); SearchResult_Sizer.Add(TDEC_Edit); Global_Sizer.Add(SearchResult_Sizer); SearchControl_Sizer.SetSpacing(10); SearchControl_Sizer.SetMargin(10); SearchOK_PushButton.SetText( "OK" ); SearchOK_PushButton.OnClick((Button::click_event_handler) &CoordSearchDialog::Button_Click,*this); SearchCancel_PushButton.SetText( "Cancel" ); SearchCancel_PushButton.OnClick((Button::click_event_handler) &CoordSearchDialog::Button_Click,*this); SearchControl_Sizer.Add(SearchOK_PushButton); SearchControl_Sizer.Add(SearchCancel_PushButton); Global_Sizer.Add(SearchControl_Sizer); SetSizer(Global_Sizer); }
void SeqEditMultiFilterWindow::SetMultiFilter(const BString& key, const BString& path) { if (!SetEntryCheck() ) return; if (!Lock()) return; mInitialKey = (const char*)NULL; mInitialAuthor = (const char*)NULL; mInitialEmail = (const char*)NULL; SetHasChanges(false); if (mMultiFilter) { AmGlobalsImpl* globals = gobals_impl(); if (globals) globals->UnregisterTemporaryMatrix(mMultiFilter->Id() ); mMultiFilter->RemoveMatrixObserver(0, this); } /* This is a bit of a hack, but the AmMultiFilter (which is the * AmPipelineMatrixI object) doesn't actually store references to itself. * So what happens is the mMultiFilter gets deleted here, then at the * end of this method the mPipelineView's matrix ref -- which is the now- * deleted mMultiFilter -- gets replaced with the new mMultiFilter. During * the replacement, the ref tries to remove a ref to the old multi filter, * and crash. So I clear it out here. */ if (mPipelineView) mPipelineView->SetMatrixRef( AmPipelineMatrixRef(NULL) ); delete mMultiFilter; mMultiFilter = NULL; if (mMultiFilterAddOn) mMultiFilterAddOn->RemReference(); mMultiFilterAddOn = NULL; const char* s = NULL; if (path.Length() > 0) s = path.String(); AmMultiFilterRoster* roster = AmMultiFilterRoster::Default(); if (roster) mMultiFilterAddOn = roster->NewFilter(key, s); if (!mMultiFilterAddOn) { const char* auth; const char* email; if (seq_get_string_preference(AUTHOR_PREF, &auth) != B_OK) auth = NULL; if (seq_get_string_preference(EMAIL_PREF, &email) != B_OK) email = NULL; mMultiFilterAddOn = new AmMultiFilterAddOn(auth, email); } if (mMultiFilterAddOn) { mMultiFilterAddOn->AddReference(); mInitialKey = mMultiFilterAddOn->Key(); mInitialAuthor = mMultiFilterAddOn->Author(); mInitialEmail = mMultiFilterAddOn->Email(); mMultiFilter = dynamic_cast<AmMultiFilter*>(mMultiFilterAddOn->NewInstance(NULL, NULL) ); if (mMultiFilter) { AmGlobalsImpl* globals = gobals_impl(); if (globals) globals->RegisterTemporaryMatrix(mMultiFilter); } SetTextControl(mNameCtrl, mMultiFilterAddOn->Label().String(), NAME_MSG); SetTextControl(mKeyCtrl, mMultiFilterAddOn->Key().String(), KEY_MSG); SetTextControl(mAuthorCtrl, mMultiFilterAddOn->Author().String(), AUTHOR_MSG); SetTextControl(mEmailCtrl, mMultiFilterAddOn->Email().String(), EMAIL_MSG); if (mShortDescriptionCtrl) mShortDescriptionCtrl->SetText( mMultiFilterAddOn->ShortDescription().String() ); if (mLongDescriptionCtrl) mLongDescriptionCtrl->SetText( mMultiFilterAddOn->LongDescriptionContents() ); if (mIconEditor) mIconEditor->SetBitmap(const_cast<BBitmap*>(mMultiFilterAddOn->Icon(BPoint(20, 20))) ); } if (mMultiFilter) { mMultiFilter->AddMatrixPipelineObserver(0, this); mMultiFilter->AddMatrixFilterObserver(0, this); } if (mPipelineView) mPipelineView->SetMatrixRef( AmPipelineMatrixRef(mMultiFilter) ); SetWindowTitle(); Unlock(); }
int main() { InitGraphics(); SetWindowTitle("CS106 Pathfinder"); cout << "This masterful piece of work is a graph extravaganza!" << endl << "The main attractions include a lovely visual presentation of the graph" << endl << "along with an implementation of Dijkstra's shortest path algorithm and" << endl << "the computation of a minimal spanning tree. Enjoy!" << endl; //double w=GetPictureWidth("Stanford.jpg"); //double h=GetPictureHeight("Stanford.jpg"); //cout<<w<<":"<<h<<endl; //cout<<GetWindowWidth()<<":"<<GetWindowHeight()<<endl; //define the map data source const string Stanford="Stanford.txt"; const string Small="Small.txt"; const string USA="USA.txt"; const string PicStanford="stanford.jpg"; const string PicUSA="USA.bmp"; //define the map data struct map<string,infoT> point; set<arcT> arc; while(true){ cout<<"0) Stanford.txt 1) Small.txt 2) USA.txt\n"; cout<<"Please select the map data source(0,1 or 2):\n"; int flag; cin>>flag; if(flag==0){ //:wq //SetWindowSize(7,5); //double w=GetPictureWidth("stanford2.png"); //double h=GetPictureHeight("stanford2.png"); //cout<<w<<":"<<h<<endl; //SetWindowSize(w,h); DrawNamedPicture("stanford2.png"); readMapData(point,arc,Stanford); break; } //double w=GetPictureWidth("USA.bmp"); //double h=GetPictureHeight("USA.bmp"); //cout<<w<<":"<<h<<endl; SetWindowSize(6.3,4); if(flag==1){ DrawNamedPicture("USA.bmp"); readMapData(point,arc,Small); break; } else if(flag==2){ DrawNamedPicture("USA.bmp"); readMapData(point,arc,USA); break; } else{ cout<<"Wrong number!"<<endl; } } //draw map DrawLabeledPointAndLine(point,arc); map<string,infoT>::iterator it=point.begin(); while(it!=point.end()){ cout<<it->first<<":"<<endl; set<laborT> la=it->second.labor; set<laborT>::iterator i=la.begin(); while(i!=la.end()){ cout<<" "<<(*i).name<<":"<<(*i).distance<<endl; i++; } it++; } while(true){ cout<<"What do you want?"<<endl; cout<<"0) draw the optional path between the slected points"<<endl; cout<<"1) draw the minimal spanning tree"<<endl; cout<<"Please select(0 or 1):"; int flag; cin>>flag; if(flag==0){ //draw the optional path DrawOptionalPath(point,arc); break; } else if(flag==1){ //draw the minimal spanning tree DrawMinimalSpanningTree(point,arc); break; } else{ cout<<"wrong number!"<<endl; } } return (0); }
static void MissionSet(void) { SetWindowTitle(); InitConfig(); MainMenu(); }
EXPORT(bool) InitVideo(int w, int h, std::string sphere_dir) { ScreenWidth = w; ScreenHeight = h; static bool firstcall = true; // Center the window on the display putenv("SDL_VIDEO_CENTERED=1"); if (firstcall) { LoadConfiguration(sphere_dir); if (!InitScreenBuffer()) return false; // initialize SDL // Note: SDL_INIT_EVENTTHREAD is currently not supported on Mac OS X if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) == -1) { fprintf(stderr, "Could not initialize SDL:\n%s\n", SDL_GetError()); return false; } SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); firstcall = false; } else { // reinitialize the screen buffer, because the new resolution can differ if (!InitScreenBuffer()) { SDL_Quit(); return false; } // reinitialize the SDL video subsystem SDL_QuitSubSystem(SDL_INIT_VIDEO); if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) { fprintf(stderr, "Could not initialize video:\n%s\n", SDL_GetError()); return false; } // keep the window title as what it was SetWindowTitle(WindowTitle.c_str()); } int s_width = ScreenBufferWidth * (Config.scale ? 2 : 1); int s_height = ScreenBufferHeight * (Config.scale ? 2 : 1); dword flags = 0; if (Config.fullscreen) flags |= SDL_FULLSCREEN; if (Config.vsync) flags |= SDL_HWSURFACE | SDL_DOUBLEBUF; else flags |= SDL_SWSURFACE; // set up the video surface SDLScreenBuffer = SDL_SetVideoMode(s_width, s_height, 32, flags); if (SDLScreenBuffer == NULL) { fprintf(stderr, "Could not set video mode:\n%s\n", SDL_GetError()); return false; } SDL_ShowCursor(false); SetClippingRectangle(0, 0, SDLScreenBuffer->w, SDLScreenBuffer->h); return true; }
ConvolutionFilterCodeDialog::ConvolutionFilterCodeDialog( String mode, const Filter& _filter ) : Dialog(), filter( _filter ) { // ### TextBox FilterCode_TextBox.SetScaledMinSize( 700, 300 ); FilterCode_TextBox.OnCaretPositionUpdated( (TextBox::caret_event_handler)&ConvolutionFilterCodeDialog::__TextBox_CaretPosition, *this ); if ( mode == "Edit" ) { FilterCode_TextBox.SetReadWrite(); FilterCode_TextBox.SetText( filter.ToSource() ); } tableRow = 0; String s; String html( "<html style=\"white-space:pre;text-align:right;\">" "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" ); StringList cols; UpdateTableColors(); if ( mode == "View" ) { FilterCode_TextBox.SetReadOnly(); if ( filter.IsSeparable() ) { SeparableFilter fs( filter.Separable() ); float element; // Rows for ( int i = 0; i < fs.Size(); ++i ) { // Cols for ( int j = 0; j < fs.Size(); ++j ) { // Calculus of each coefficient of the separable filter element = Round( fs.ColFilter()[i] * fs.RowFilter()[j], 6 ); cols.Add( String().Format( "%10.6f", element ) ); } html += TR( cols ); cols.Clear(); } } else { KernelFilter k( filter.Kernel() ); for ( int i = 0; i < k.Size(); ++i ) { for ( int j = 0; j < k.Size(); ++j ) { float element = Round( k.Coefficients()[i][j], 6 ); // The elements of the KernelFilter can be accessed directly God thanks and the [] operator. cols.Add( String().Format( "%10.6f", element ) ); } html += TR( cols ); cols.Clear(); } } html += "</table></html>"; // We got it!! we set the TextBox text by passing the composed String s. FilterCode_TextBox.SetText( html ); UpdateTableColors(); } if ( mode == "View" ) LineCol_Label.Hide(); else LineCol_Label.Show(); LineCol_Sizer.SetSpacing( 4 ); LineCol_Sizer.Add( LineCol_Label ); LineCol_Sizer.AddStretch(); // ### Save PushButton Save_PushButton.SetText( "Save" ); Save_PushButton.SetCursor( StdCursor::Checkmark ); Save_PushButton.OnClick( (Button::click_event_handler)&ConvolutionFilterCodeDialog::__Button_Click, *this ); if ( mode == "View" ) Save_PushButton.Hide(); else Save_PushButton.SetDefault(); if ( mode == "View" ) { Cancel_PushButton.SetText( "Close" ); Cancel_PushButton.SetCursor( StdCursor::Checkmark ); Cancel_PushButton.SetDefault(); } else { Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); } Cancel_PushButton.OnClick( (Button::click_event_handler)&ConvolutionFilterCodeDialog::__Button_Click, *this ); DialogButtons_Sizer.SetSpacing( 8 ); DialogButtons_Sizer.AddStretch(); DialogButtons_Sizer.Add( Save_PushButton ); DialogButtons_Sizer.Add( Cancel_PushButton ); DialogButtons_Sizer.AddStretch(); Global_Sizer.SetMargin( 4 ); Global_Sizer.SetSpacing( 4 ); Global_Sizer.Add( FilterCode_TextBox ); Global_Sizer.Add( LineCol_Sizer ); Global_Sizer.Add( DialogButtons_Sizer ); SetSizer( Global_Sizer ); EnableUserResizing(); AdjustToContents(); BringToFront(); //SetFixedSize(); if ( mode == "View" ) SetWindowTitle( '\"' + filter.Name() + '\"' + " filter elements" ); else if ( mode == "Edit" ) SetWindowTitle( '\"' + filter.Name() + '\"' + " edit" ); else if ( mode == "New" ) SetWindowTitle( "New filter" ); else throw Error( "Internal error: Invalid dialog operation mode in ConvolutionFilterCodeDialog" ); }
INT main ( int argc, char **argv ) { ULONG ulFlags; QMSG qmMsg; HMQ hmqQueue; HWND hwndFrame; HWND hwndClient; CHAR szAppClass[MAX_STRING_BYTES]; /* * Copy the fully-qualified executable filename into szExecFile. */ strcpy( szExecFile, argv[0] ); /* * Get the anchor block and initialize the message queue */ habAnchor = WinInitialize ( 0 ) ; hmqQueue = WinCreateMsgQueue ( habAnchor, 0 ) ; /* * Run the initialization routines on all other modules. */ h2cursor_init(); h2edit_init(); h2file_init(); h2font_init(); h2help_init(); h2reg_init(); h2screen_init(); h2search_init(); /* * Register the client window class name and window procedure. Make the class * name the same as the application name. */ strncpy( szAppClass, szAppName, MAX_STRING_BYTES ); WinRegisterClass ( habAnchor, szAppClass, ClientWndProc, CS_SIZEREDRAW, 0 ) ; /* * Create a standard window with vertical and horizontal scroll bars. Keep it * invisible for now. */ ulFlags = FCF_STANDARD | FCF_VERTSCROLL | FCF_HORZSCROLL; hwndFrame = WinCreateStdWindow ( HWND_DESKTOP, 0, /// WS_VISIBLE, &ulFlags, szAppClass, szAppName, 0, NULLHANDLE, RES_CLIENT, &hwndClient ) ; /* * If frame creation was successful, proceed with the remainder * of the window startup tasks. */ if ( hwndFrame != NULLHANDLE ) { /* * Restore the window settings (if any) and display the window. */ if ( RestoreSettings( hwndClient, habAnchor ) ) { UpdateScreenLimits( hwndClient, TRUE ); } DisplayAboutPanel( hwndClient, 2 ); WinSetWindowPos( hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_SHOW ); /* * Create a help instance. */ CreateHelpInstance( habAnchor, hwndFrame, szExecFile ); /* * If anything was specified on the command line, treat it as a file and * read it in. */ if ( argc > 1 ) { if ( FileOpenDialog( hwndClient, argv[1] ) ) { SetWindowTitle( hwndClient ); UpdateScreenLimits( hwndClient, TRUE ); } } /* * Do the get message/dispatch message loop until done (WM_QUIT * posted to the message queue). */ while ( WinGetMsg( habAnchor, &qmMsg, NULLHANDLE, 0, 0 ) ) WinDispatchMsg ( habAnchor, &qmMsg ); /* * Destroy the help instance. */ DestroyHelpInstance(); /* * And destroy the frame window (and all child windows). */ WinDestroyWindow ( hwndFrame ) ; } /* * Cleanup - destroy the message queue, release the anchor block, and return. */ WinDestroyMsgQueue ( hmqQueue ) ; WinTerminate ( habAnchor ) ; return 0 ; }
MRESULT ProcessCommandMsg ( HWND hwndWnd, ULONG ulMsg, MPARAM mpParm1, MPARAM mpParm2 ) { switch ( SHORT1FROMMP( mpParm1 ) ) { /* * First, the menu selections. */ case IDM_FILE_OPEN: if ( QueryAbandonChanges( hwndWnd ) ) { if ( FileOpenDialog( hwndWnd, NULL ) ) { SetWindowTitle( hwndWnd ); UpdateScreenLimits( hwndWnd, TRUE ); } } break; case IDM_FILE_SAVE: FileSaveDialog( hwndWnd, szFileName ); SetWindowTitle( hwndWnd ); break; case IDM_FILE_SAVE_AS: FileSaveDialog( hwndWnd, NULL ); SetWindowTitle( hwndWnd ); break; case IDM_FILE_CLEAR: if ( QueryAbandonChanges( hwndWnd ) ) { ClearFile( hwndWnd ); SetWindowTitle( hwndWnd ); UpdateScreenLimits( hwndWnd, TRUE ); } break; case IDM_FILE_ALLOCATE: if ( QueryAbandonChanges( hwndWnd ) ) { if ( FileAllocateDialog( hwndWnd ) ) { SetWindowTitle( hwndWnd ); UpdateScreenLimits( hwndWnd, TRUE ); } } break; case IDM_FILE_RESIZE: if ( FileResizeDialog( hwndWnd ) ) { UpdateScreenLimits( hwndWnd, TRUE ); } break; case IDM_FILE_EXIT: if ( QueryAbandonChanges( hwndWnd ) ) { ClearFile( hwndWnd ); WinPostMsg(hwndWnd, WM_QUIT, 0L, 0L); } break; case IDM_EDIT_CUT: if ( EditCut( hwndWnd ) ) { SetWindowTitle( hwndWnd ); UpdateScreenLimits( hwndWnd, TRUE ); } break; case IDM_EDIT_COPY: if ( EditCopy( hwndWnd ) ) { SetWindowTitle( hwndWnd ); UpdateScreenLimits( hwndWnd, TRUE ); } break; case IDM_EDIT_PASTE: if ( EditPaste( hwndWnd ) ) { SetWindowTitle( hwndWnd ); UpdateScreenLimits( hwndWnd, TRUE ); } break; case IDM_EDIT_DELETE: if ( EditDelete( hwndWnd ) ) { SetWindowTitle( hwndWnd ); UpdateScreenLimits( hwndWnd, TRUE ); } break; case IDM_EDIT_INSERT: if ( EditInsert( hwndWnd ) ) { SetWindowTitle( hwndWnd ); UpdateScreenLimits( hwndWnd, TRUE ); } break; case IDM_SEARCH_FORWARD: SearchForward( hwndWnd ); break; case IDM_SEARCH_BACKWARD: SearchBackward( hwndWnd ); break; case IDM_SEARCH_AGAIN: SearchAgain( hwndWnd ); break; case IDM_REPLACE_FORWARD: ReplaceForward( hwndWnd ); break; case IDM_REPLACE_BACKWARD: ReplaceBackward( hwndWnd ); break; case IDM_REPLACE_AGAIN: ReplaceAgain( hwndWnd ); break; case IDM_GOTO_OFFSET: GotoOffset( hwndWnd ); break; case IDM_OPTIONS_FONT: FontSelectDialog( hwndWnd ); break; case IDM_OPTIONS_READONLY: bReadOnly ^= TRUE; WinSendMsg( hwndMenu, MM_SETITEMATTR, MPFROM2SHORT( IDM_OPTIONS_READONLY, TRUE ), MPFROM2SHORT( MIA_CHECKED, bReadOnly ? MIA_CHECKED : 0 ) ); break; case IDM_OPTIONS_AUTORESIZE: bAutoResize ^= TRUE; WinSendMsg( hwndMenu, MM_SETITEMATTR, MPFROM2SHORT( IDM_OPTIONS_AUTORESIZE, TRUE ), MPFROM2SHORT( MIA_CHECKED, bAutoResize ? MIA_CHECKED : 0 ) ); if ( bAutoResize ) UpdateScreenLimits( hwndWnd, TRUE ); break; case IDM_OPTIONS_REGISTER: DisplayRegistrationPanel( hwndWnd ); break; case IDM_DISPLAY: DisplayModeDialog( hwndWnd ); break; /* * Next, the DISPLAY dialog accelerator keys */ case IDD_DISPLAY_OFFSET_OCTAL: case IDD_DISPLAY_OFFSET_DECIMAL: case IDD_DISPLAY_OFFSET_HEX: case IDD_DISPLAY_ENTITY_OCTAL: case IDD_DISPLAY_ENTITY_DECIMAL: case IDD_DISPLAY_ENTITY_HEX: case IDD_DISPLAY_1_BYTE: case IDD_DISPLAY_2_BYTE: case IDD_DISPLAY_4_BYTE: DisplayModeAccelKey( hwndWnd, SHORT1FROMMP( mpParm1 ) ); break; /* * And the default */ default: return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 ); break; } return MRFROMSHORT ( FALSE ) ; }
MRESULT EXPENTRY ClientWndProc ( HWND hwndWnd, ULONG ulMsg, MPARAM mpParm1, MPARAM mpParm2 ) { switch ( ulMsg ) { // For HELP debugging #if 0 case HM_ERROR: { CHAR szTempBuffer[256]; sprintf( szTempBuffer, "Received HM_ERROR message, mp1=0X%8.8X", (ULONG)mpParm1 ); WinMessageBox ( HWND_DESKTOP, HWND_DESKTOP, szTempBuffer, "HM_ERROR", 0, MB_OK ); } break; case HM_EXT_HELP_UNDEFINED: WinMessageBox ( HWND_DESKTOP, HWND_DESKTOP, "Received HM_EXT_HELP_UNDEFINED message", "HM_EXT_HELP_UNDEFINED", 0, MB_OK ); break; case HM_HELPSUBITEM_NOT_FOUND: WinMessageBox ( HWND_DESKTOP, HWND_DESKTOP, "Received HM_HELPSUBITEM_NOT_FOUND message", "HM_HELPSUBITEM_NOT_FOUND", 0, MB_OK ); break; #endif case HM_QUERY_KEYS_HELP: return (MRESULT)IDP_KEYS_INFO; break; case WM_BUTTON1CLICK: MoveCursorToPointer( hwndWnd, (*(POINTS *)&mpParm1).x, (*(POINTS *)&mpParm1).y ); break; #if 0 case WM_BUTTON2CLICK: { HPS hpsClient; POINTL ptl; INT xC, yC; xC = ( ( (*(POINTS *)&mpParm1).x - cxChar) / cxChar ); yC = ( ( cyClient - (*(POINTS *)&mpParm1).y ) / cyChar ); hpsClient = WinGetPS( hwndWnd ); GpiSetColor( hpsClient, CLR_PALEGRAY ); if ( xC < 10 ) GpiSetMix( hpsClient, FM_XOR ); else if ( xC < 20 ) GpiSetMix( hpsClient, FM_INVERT ); else if ( xC < 30 ) GpiSetMix( hpsClient, FM_NOTXORSRC ); else if ( xC < 40 ) GpiSetMix( hpsClient, FM_NOTMASKSRC ); else if ( xC < 50 ) GpiSetMix( hpsClient, FM_SUBTRACT ); /// GpiSetBackColor( hpsClient, CLR_PALEGRAY ); /// GpiSetBackMix( hpsClient, BM_OVERPAINT ); /// ptl.x = ( ( (*(POINTS *)&mpParm1).x - cxChar ) / cxChar ) * cxChar + cxChar; /// ptl.y = ( ( (*(POINTS *)&mpParm1).y - cyClient ) / cyChar - 1 ) * cyChar + cyClient; ptl.x = cxChar + ( xC * cxChar ); ptl.y = cyClient - ( ( yC + 1) * cyChar ); GpiMove( hpsClient, &ptl ); ptl.x += cxChar; ptl.y += cyChar; if ( yC < 5 ) GpiBox( hpsClient, DRO_FILL, &ptl, 0, 0 ); else GpiBox( hpsClient, DRO_OUTLINE, &ptl, 0, 0 ); /// GpiSetBackColor( hpsClient, CLR_BACKGROUND ); /// GpiSetMix( hpsClient, FM_DEFAULT ); WinReleasePS( hpsClient ); } break; #endif case WM_CHAR: if ( !( CHARMSG(&ulMsg)->fs & KC_KEYUP ) ) { if ( CHARMSG(&ulMsg)->fs & KC_CHAR ) { ProcessCharMsg( hwndWnd, ulMsg, mpParm1, mpParm2 ); } else if ( CHARMSG(&ulMsg)->fs & KC_VIRTUALKEY ) { if ( !ProcessCursorMsg( hwndWnd, ulMsg, mpParm1, mpParm2 ) ) { return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 ); } } } break; case WM_CLOSE: if ( QueryAbandonChanges( hwndWnd ) ) return WinDefWindowProc ( hwndWnd, ulMsg, mpParm1, mpParm2 ); break; case WM_COMMAND: return ProcessCommandMsg( hwndWnd, ulMsg, mpParm1, mpParm2 ); break; case WM_CREATE: hwndMenu = WinWindowFromID( WinQueryWindow( hwndWnd, QW_PARENT ), FID_MENU ); hwndHScroll = WinWindowFromID( WinQueryWindow( hwndWnd, QW_PARENT ), FID_HORZSCROLL ); hwndVScroll = WinWindowFromID( WinQueryWindow( hwndWnd, QW_PARENT ), FID_VERTSCROLL ); SetWindowTitle( hwndWnd ); break; case WM_DESTROY: ClearFile( hwndWnd ); break; case WM_ERASEBACKGROUND: return MRFROMSHORT ( TRUE ) ; case WM_HELP: ProcessHelpMessage( hwndWnd, mpParm1, mpParm2 ); break; case WM_HSCROLL: if ( !ProcessHScrollMsg( hwndWnd, ulMsg, mpParm1, mpParm2 ) ) return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 ); break; case WM_PAINT: PaintScreen( hwndWnd ); break; case WM_SAVEAPPLICATION: SaveSettings( hwndWnd, habAnchor ); return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 ); break; case WM_SETFOCUS: if ( SHORT1FROMMP( mpParm2 ) ) CreateCursor( hwndWnd ); else DestroyCursor( hwndWnd ); break; case WM_SIZE: UpdateWindowSize( hwndWnd, SHORT1FROMMP( mpParm2), SHORT2FROMMP( mpParm2 ) ); if ( hwndWnd == WinQueryFocus( HWND_DESKTOP ) ) { DestroyCursor( hwndWnd ); CreateCursor( hwndWnd ); } break; case WM_VSCROLL: if ( !ProcessVScrollMsg( hwndWnd, ulMsg, mpParm1, mpParm2 ) ) return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 ); break; default: return WinDefWindowProc( hwndWnd, ulMsg, mpParm1, mpParm2 ); break; } return MRFROMSHORT ( FALSE ) ; }
FileDataCachePreferencesDialog::FileDataCachePreferencesDialog( FileDataCache* theCache ) : Dialog(), cache( theCache ) { int labelWidth1 = Font().Width( String( "Cache duration (days):" ) + 'T' ); int ui4 = LogicalPixelsToPhysical( 4 ); // const char* persistentCacheToolTip = "<p>Use a persistent file cache to store statistical data and noise " "estimates of all integrated images. A persistent cache is kept across " "PixInsight sessions. If you disable this option, the file cache will " "still be used, but only during the current session; as soon as you exit " "the PixInsight Core application, all the cached information will be lost. " "With the persistent cache option enabled, all cache items will be stored " "and will be available the next time you run PixInsight.</p>" "<p>The cache greatly improves performance when the same images are being " "integrated several times; for example to find optimal pixel rejection " "parameters, or to check different HDR composition thresholds.</p>"; PersistentCache_CheckBox.SetText( "Persistent file cache" ); PersistentCache_CheckBox.SetToolTip( persistentCacheToolTip ); PersistentCache_CheckBox.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this ); PersistentCache_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 ); PersistentCache_Sizer.Add( PersistentCache_CheckBox ); PersistentCache_Sizer.AddStretch(); // const char* cacheDurationToolTip = "<p>Persistent file cache items can be automatically removed after a " "specified period without accessing the corresponding files. Enter the " "desired period in days, or specify zero to disable this <i>automatic purge</i> " "feature, so that existing file cache items will never be removed " "automatically.</p>"; CacheDuration_Label.SetText( "Cache duration (days):" ); CacheDuration_Label.SetMinWidth( labelWidth1 ); CacheDuration_Label.SetToolTip( cacheDurationToolTip ); CacheDuration_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter ); CacheDuration_SpinBox.SetRange( 0, 90 ); CacheDuration_SpinBox.SetMinimumValueText( "<Forever>" ); CacheDuration_SpinBox.SetToolTip( cacheDurationToolTip ); CacheDuration_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&FileDataCachePreferencesDialog::SpinBox_ValueUpdated, *this ); CacheDuration_Sizer.SetSpacing( 4 ); CacheDuration_Sizer.Add( CacheDuration_Label ); CacheDuration_Sizer.Add( CacheDuration_SpinBox ); CacheDuration_Sizer.AddStretch(); // ClearCache_PushButton.SetText( "Clear Memory Cache Now" ); ClearCache_PushButton.SetToolTip( "Click this button to remove all cache items currently stored in volatile RAM." ); ClearCache_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this ); ClearCache_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 ); ClearCache_Sizer.Add( ClearCache_PushButton, 100 ); // PurgeCache_PushButton.SetText( "Purge Persistent Cache Now" ); PurgeCache_PushButton.SetToolTip( "Click this button to remove all stored persistent cache items." ); PurgeCache_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this ); PurgeCache_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 ); PurgeCache_Sizer.Add( PurgeCache_PushButton, 100 ); // OK_PushButton.SetText( "OK" ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this ); Buttons_Sizer.SetSpacing( 8 ); Buttons_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 ); Buttons_Sizer.Add( OK_PushButton ); Buttons_Sizer.Add( Cancel_PushButton ); // Global_Sizer.SetMargin( 8 ); Global_Sizer.SetSpacing( 6 ); Global_Sizer.Add( PersistentCache_Sizer ); Global_Sizer.Add( CacheDuration_Sizer ); Global_Sizer.Add( ClearCache_Sizer ); Global_Sizer.Add( PurgeCache_Sizer ); Global_Sizer.AddSpacing( 4 ); Global_Sizer.Add( Buttons_Sizer ); SetSizer( Global_Sizer ); AdjustToContents(); SetFixedSize(); // SetWindowTitle( cache->CacheName() + " Preferences" ); OnReturn( (pcl::Dialog::return_event_handler)&FileDataCachePreferencesDialog::Dialog_Return, *this ); cacheEnabled = cache->IsEnabled(); cacheDuration = cache->Duration(); Update(); }
NyqBench::NyqBench(wxWindow * parent) : wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER) { mFindDlg = NULL; mRunning = false; mScriptBox = NULL; mOutputBox = NULL; mScript = NULL; mOutput = NULL; mPath = gPrefs->Read(wxT("NyqBench/Path"), wxEmptyString); mAutoLoad = (gPrefs->Read(wxT("NyqBench/AutoLoad"), 0L) != 0); mAutoWrap = (gPrefs->Read(wxT("NyqBench/AutoWrap"), true) != 0); mLargeIcons = (gPrefs->Read(wxT("NyqBench/LargeIcons"), 0L) != 0); mSplitMode = gPrefs->Read(wxT("NyqBench/SplitMode"), wxSPLIT_VERTICAL); mShowCode = (gPrefs->Read(wxT("NyqBench/ShowScript"), true) != 0); mShowOutput = (gPrefs->Read(wxT("NyqBench/ShowOutput"), true) != 0); SetIcon(wxICON(AudacityLogo)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); ShuttleGui S(this, eIsCreating); PopulateOrExchange(S); wxMenuBar *bar = new wxMenuBar(); wxMenu *menu = new wxMenu(); menu->Append(wxID_NEW, wxT("&New\tCtrl+N")); menu->Append(wxID_OPEN, wxT("&Open...\tCtrl+O")); menu->Append(wxID_SAVE, wxT("&Save...\tCtrl+S")); menu->Append(wxID_SAVEAS, wxT("Save &As...\tCtrl+Shift+S")); menu->AppendSeparator(); menu->Append(wxID_REVERT_TO_SAVED, _T("&Revert to Saved")); menu->AppendSeparator(); menu->AppendCheckItem(ID_AUTOLOAD, _T("Auto &Load Last File"))->Check(mAutoLoad); menu->AppendSeparator(); menu->Append(wxID_CLOSE, wxT("&Close Window\tCtrl+W")); bar->Append(menu, wxT("&File")); menu = new wxMenu(); menu->Append(wxID_UNDO, _("&Undo\tCtrl+Z")); menu->Append(wxID_REDO, _("&Redo\tCtrl+Y")); menu->AppendSeparator(); menu->Append(wxID_CUT, _("Cu&t\tCtrl+X")); menu->Append(wxID_COPY, _("&Copy\tCtrl+C")); menu->Append(wxID_PASTE, _("&Paste\tCtrl+V")); menu->Append(wxID_CLEAR, _("Cle&ar\tCtrl+L")); menu->AppendSeparator(); menu->Append(wxID_SELECTALL, _("Select A&ll\tCtrl+A")); menu->AppendSeparator(); menu->Append(wxID_FIND, _("&Find...\tCtrl+F")); menu->AppendSeparator(); wxMenu *sub = new wxMenu(); sub->Append(ID_MATCH, _("&Matching Paren\tF8")); sub->Append(ID_TOP, _("&Top S-expr\tF9")); sub->Append(ID_UP, _("&Higher S-expr\tF10")); sub->Append(ID_PREVIOUS, _("&Previous S-expr\tF11")); sub->Append(ID_NEXT, _("&Next S-expr\tF12")); menu->AppendSubMenu(sub, _("&Go to")); menu->AppendSeparator(); menu->AppendCheckItem(ID_AUTOWRAP, _T("Auto &Wrap"))->Check(mAutoWrap); bar->Append(menu, wxT("&Edit")); menu = new wxMenu(); menu->Append(ID_FONT, _("Select &Font...")); menu->AppendSeparator(); menu->Append(ID_SPLITV, _("Split &Vertically")); menu->Append(ID_SPLITH, _("Split &Horizontally")); menu->AppendSeparator(); menu->AppendCheckItem(ID_TOGGLECODE, _("Show S&cript")); menu->AppendCheckItem(ID_TOGGLEOUTPUT, _("Show &Output")); menu->AppendSeparator(); sub = new wxMenu(); sub->AppendRadioItem(ID_LARGEICONS, _("&Large Icons")); sub->AppendRadioItem(ID_SMALLICONS, _("&Small Icons")); menu->AppendSubMenu(sub, _("Toolbar")); bar->Append(menu, wxT("&View")); menu = new wxMenu(); menu->Append(ID_GO, _("&Go\tF5")); menu->Append(ID_STOP, _("&Stop\tF6")); bar->Append(menu, wxT("&Run")); #if defined(__WXMAC__) menu->Append(wxID_ABOUT, _("&About")); #else menu = new wxMenu(); menu->Append(wxID_ABOUT, _("&About")); bar->Append(menu, wxT("Help")); #endif SetMenuBar(bar); RecreateToolbar(mLargeIcons); wxRect r; r.SetX(gPrefs->Read(wxT("NyqBench/Window/X"), -1)); r.SetY(gPrefs->Read(wxT("NyqBench/Window/Y"), -1)); r.SetWidth(gPrefs->Read(wxT("NyqBench/Window/Width"), -1)); r.SetHeight(gPrefs->Read(wxT("NyqBench/Window/Height"), -1)); if (r == wxRect(-1, -1, -1, -1)) { Center(); } else { SetSize(r); } bool maximized = false; gPrefs->Read(wxT("NyqBench/Window/Maximized"), maximized); if (maximized) { Maximize(); } long sashpos; sashpos = gPrefs->Read(wxT("NyqBench/SplitX"), 0l); if (sashpos > 0) { mSplitter->SetSashPosition(sashpos); } wxString dflt = wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT).GetNativeFontInfoDesc(); wxString desc; wxTextAttr attr; desc = gPrefs->Read(wxT("NyqBench/ScriptFont"), dflt); mScriptFont.SetNativeFontInfo(desc); #if defined(__WXMSW__) // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText(). // I don't know if this is something I'm doing wrong, but I'll have to look at this // later if I get bored. mScriptFont.SetEncoding(wxFONTENCODING_SYSTEM); #endif attr.SetFont(mScriptFont); mScript->SetDefaultStyle(attr); desc = gPrefs->Read(wxT("NyqBench/OutputFont"), dflt); mOutputFont.SetNativeFontInfo(desc); #if defined(__WXMSW__) // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText(). // I don't know if this is something I'm doing wrong, but I'll have to look at this // later if I get bored. mOutputFont.SetEncoding(wxFONTENCODING_SYSTEM); #endif attr.SetFont(mOutputFont); mOutput->SetDefaultStyle(attr); if (mAutoLoad && !mPath.GetFullPath().IsEmpty()) { LoadFile(); } SetWindowTitle(); }
JPEG2000OptionsDialog::JPEG2000OptionsDialog( const ImageOptions& o, const JPEG2000ImageOptions& t, bool isJPC ) : Dialog(), options(), jp2Options() { int labelWidth1 = Font().Width( String( "Decompression Layers:" ) + 'M' ); Lossless_RadioButton.SetText( "Lossless" ); Lossless_RadioButton.SetToolTip( "Nondestructive compression" ); Lossless_RadioButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::CompressionMode_Click, *this ); Lossy_RadioButton.SetText( "Lossy" ); Lossy_RadioButton.SetToolTip( "Destructive compression" ); Lossy_RadioButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::CompressionMode_Click, *this ); CompressionRate_NumericControl.label.SetText( "Compression Rate:" ); CompressionRate_NumericControl.label.SetMinWidth( labelWidth1 ); CompressionRate_NumericControl.slider.SetScaledMinWidth( 125 ); CompressionRate_NumericControl.slider.SetRange( 1, 999 ); CompressionRate_NumericControl.SetReal( true ); CompressionRate_NumericControl.SetRange( 0.01, 0.99 ); CompressionRate_NumericControl.SetPrecision( 2 ); CompressionRate_NumericControl.SetToolTip( "Compression factor: compressed/original size" ); UnsignedSample_CheckBox.SetText( "Unsigned Samples" ); UnsignedSample_CheckBox.SetToolTip( "Write unsigned sample values" ); Compression_Sizer.SetMargin( 6 ); Compression_Sizer.Add( Lossless_RadioButton ); Compression_Sizer.AddSpacing( 6 ); Compression_Sizer.Add( Lossy_RadioButton ); Compression_Sizer.Add( CompressionRate_NumericControl ); Compression_Sizer.AddSpacing( 8 ); Compression_Sizer.Add( UnsignedSample_CheckBox ); Compression_GroupBox.SetTitle( "Compression" ); Compression_GroupBox.SetSizer( Compression_Sizer ); Compression_GroupBox.AdjustToContents(); Compression_GroupBox.SetMinSize(); // DecompressionLayers_Label.SetText( "Decompression Layers:" ); DecompressionLayers_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter ); DecompressionLayers_Label.SetMinWidth( labelWidth1 ); DecompressionLayers_SpinBox.SetRange( 2, 10 ); DecompressionLayers_SpinBox.SetMinWidth( Font().Width( "000000" ) ); DecompressionLayers_Sizer.SetSpacing( 6 ); DecompressionLayers_Sizer.Add( DecompressionLayers_Label ); DecompressionLayers_Sizer.Add( DecompressionLayers_SpinBox ); DecompressionLayers_Sizer.AddStretch(); ProgressionOrder_Label.SetText( "Progression Order:" ); ProgressionOrder_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter ); ProgressionOrder_Label.SetMinWidth( labelWidth1 ); ProgressionOrder_ComboBox.AddItem( "LRCP: Layer-Resolution-Component-Position" ); ProgressionOrder_ComboBox.AddItem( "RLCP: Resolution-Layer-Component-Position" ); ProgressionOrder_ComboBox.AddItem( "RPCL: Resolution-Position-Component-Layer" ); ProgressionOrder_ComboBox.AddItem( "PCRL: Position-Component-Resolution-Layer" ); ProgressionOrder_ComboBox.AddItem( "CPRL: Component-Position-Resolution-Layer" ); ProgressionOrder_Sizer.SetSpacing( 6 ); ProgressionOrder_Sizer.Add( ProgressionOrder_Label ); ProgressionOrder_Sizer.Add( ProgressionOrder_ComboBox, 100 ); Progressive_Sizer.SetMargin( 6 ); Progressive_Sizer.SetSpacing( 6 ); Progressive_Sizer.Add( DecompressionLayers_Sizer ); Progressive_Sizer.Add( ProgressionOrder_Sizer ); Progressive_GroupBox.SetTitle( "Progressive Decoding" ); Progressive_GroupBox.EnableTitleCheckBox(); Progressive_GroupBox.SetSizer( Progressive_Sizer ); Progressive_GroupBox.AdjustToContents(); Progressive_GroupBox.SetMinSize(); // TileWidth_NumericEdit.label.SetText( "Tile Width:" ); TileWidth_NumericEdit.label.SetMinWidth( labelWidth1 ); TileWidth_NumericEdit.SetInteger(); TileWidth_NumericEdit.SetRange( 16, 8192 ); TileHeight_NumericEdit.label.SetText( "Tile Height:" ); TileHeight_NumericEdit.SetInteger(); TileHeight_NumericEdit.SetRange( 16, 8192 ); Tiled_Sizer.SetMargin( 6 ); Tiled_Sizer.Add( TileWidth_NumericEdit ); Tiled_Sizer.AddStretch( 25 ); Tiled_Sizer.Add( TileHeight_NumericEdit ); Tiled_Sizer.AddStretch( 75 ); Tiled_GroupBox.SetTitle( "Tiled Image" ); Tiled_GroupBox.EnableTitleCheckBox(); Tiled_GroupBox.SetSizer( Tiled_Sizer ); Tiled_GroupBox.AdjustToContents(); Tiled_GroupBox.SetMinSize(); // ICCProfile_CheckBox.SetText( "ICC Profile" ); ICCProfile_CheckBox.SetToolTip( "Embed an ICC profile" ); Resolution_CheckBox.SetText( "Resolution" ); Resolution_CheckBox.SetToolTip( "Embed image resolution information" ); EmbeddedData_Sizer.SetMargin( 6 ); EmbeddedData_Sizer.Add( ICCProfile_CheckBox ); EmbeddedData_Sizer.Add( Resolution_CheckBox ); EmbeddedData_GroupBox.SetTitle( "Embedded Data" ); EmbeddedData_GroupBox.SetSizer( EmbeddedData_Sizer ); EmbeddedData_GroupBox.AdjustToContents(); EmbeddedData_GroupBox.SetMinSize(); if ( isJPC ) EmbeddedData_GroupBox.Hide(); // OK_PushButton.SetText( "OK" ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::Button_Click, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::Button_Click, *this ); BottomSection_Sizer.SetSpacing( 8 ); BottomSection_Sizer.AddStretch(); BottomSection_Sizer.Add( OK_PushButton ); BottomSection_Sizer.Add( Cancel_PushButton ); // Global_Sizer.SetMargin( 8 ); Global_Sizer.SetSpacing( 8 ); Global_Sizer.Add( Compression_GroupBox ); Global_Sizer.Add( Progressive_GroupBox ); Global_Sizer.Add( Tiled_GroupBox ); Global_Sizer.Add( EmbeddedData_GroupBox ); Global_Sizer.AddSpacing( 8 ); Global_Sizer.Add( BottomSection_Sizer ); SetSizer( Global_Sizer ); AdjustToContents(); SetFixedSize(); SetWindowTitle( isJPC ? "JPEG2000 Code Stream Options" : "JPEG2000 JP2 Options" ); OnReturn( (pcl::Dialog::return_event_handler)&JPEG2000OptionsDialog::Dialog_Return, *this ); options = o; jp2Options = t; Lossless_RadioButton.SetChecked( !jp2Options.lossyCompression ); Lossy_RadioButton.SetChecked( jp2Options.lossyCompression ); CompressionRate_NumericControl.Enable( jp2Options.lossyCompression ); CompressionRate_NumericControl.SetValue( jp2Options.compressionRate ); UnsignedSample_CheckBox.SetChecked( !jp2Options.signedSample ); Progressive_GroupBox.SetChecked( jp2Options.numberOfLayers > 1 ); DecompressionLayers_SpinBox.SetValue( jp2Options.numberOfLayers ); ProgressionOrder_ComboBox.SetCurrentItem( jp2Options.progressionOrder ); Tiled_GroupBox.SetChecked( jp2Options.tiledImage ); TileWidth_NumericEdit.SetValue( jp2Options.tileWidth ); TileHeight_NumericEdit.SetValue( jp2Options.tileHeight ); ICCProfile_CheckBox.SetChecked( options.embedICCProfile ); Resolution_CheckBox.SetChecked( jp2Options.resolutionData ); }
DynamicCropPreferencesDialog::DynamicCropPreferencesDialog() : Dialog() { savedColor = fillColor; pcl::Font fnt = Font(); int buttonWidth = fnt.Width( String( "Cancel" ) + String( 'M', 4 ) ); Black_RadioButton.SetText( "Black" ); Black_RadioButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this ); White_RadioButton.SetText( "White" ); White_RadioButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this ); Alpha_Label.SetText( "Alpha Blend:" ); Alpha_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter ); Alpha_Slider.SetRange( 0, 255 ); Alpha_Slider.SetStepSize( 10 ); Alpha_Slider.SetTickFrequency( 10 ); Alpha_Slider.SetTickStyle( TickStyle::NoTicks ); Alpha_Slider.SetScaledMinWidth( 265 ); Alpha_Slider.OnValueUpdated( (Slider::value_event_handler)&DynamicCropPreferencesDialog::Slider_ValueUpdated, *this ); FillColor_Sizer.SetMargin( 8 ); FillColor_Sizer.SetSpacing( 6 ); FillColor_Sizer.Add( Black_RadioButton ); FillColor_Sizer.Add( White_RadioButton ); FillColor_Sizer.AddSpacing( 10 ); FillColor_Sizer.Add( Alpha_Label ); FillColor_Sizer.Add( Alpha_Slider ); FillColor_GroupBox.SetTitle( "Fill Color" ); FillColor_GroupBox.SetSizer( FillColor_Sizer ); OK_PushButton.SetText( "OK" ); OK_PushButton.SetMinWidth( buttonWidth ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetMinWidth( buttonWidth ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this ); Buttons_Sizer.SetSpacing( 8 ); Buttons_Sizer.AddStretch(); Buttons_Sizer.Add( OK_PushButton ); Buttons_Sizer.Add( Cancel_PushButton ); Global_Sizer.SetMargin( 8 ); Global_Sizer.SetSpacing( 6 ); Global_Sizer.Add( FillColor_GroupBox ); Global_Sizer.AddSpacing( 4 ); Global_Sizer.Add( Buttons_Sizer ); SetSizer( Global_Sizer ); AdjustToContents(); SetFixedSize(); SetWindowTitle( "DynamicCrop Interface Preferences" ); OnReturn( (pcl::Dialog::return_event_handler)&DynamicCropPreferencesDialog::Dialog_Return, *this ); Black_RadioButton.SetChecked( Red( fillColor ) == 0 ); White_RadioButton.SetChecked( Red( fillColor ) != 0 ); Alpha_Slider.SetValue( Alpha( fillColor ) ); Update(); }
EditEqCoordPropertyDialog::EditEqCoordPropertyDialog(String raCoord, String decCoord):m_ra_hour(0),m_ra_minute(0),m_ra_second(0),m_dec_deg(0),m_dec_arcsecond(0),m_dec_arcminute(0),m_DEC_TargetCoord(String("")){ pcl::Font fnt = Font(); int labelWidth = fnt.Width(String('0', 20)); int editWidth = fnt.Width(String('0', 4)); CoordUtils::HMS ra_hms = CoordUtils::parse(raCoord); CoordUtils::HMS dec_hms = CoordUtils::parse(decCoord); SetWindowTitle( "Set equatorial coordinates for target object." ); RA_Property_Label.SetMinWidth(labelWidth); RA_Property_Label.SetText( "RA (hh:mm:ss.ss)" ); RA_Property_Label.SetTextAlignment(TextAlign::Left | TextAlign::VertCenter); RA_Hour_Edit.SetMaxWidth(editWidth); RA_Hour_Edit.SetText(IsoString(ra_hms.hour)); RA_Hour_Edit.OnEditCompleted( (Edit::edit_event_handler) &EditEqCoordPropertyDialog::EditCompleted, *this); RA_Colon1_Label.SetText(":"); RA_Minute_Edit.SetMaxWidth(editWidth); RA_Minute_Edit.SetText(IsoString(ra_hms.minute)); RA_Minute_Edit.OnEditCompleted( (Edit::edit_event_handler) &EditEqCoordPropertyDialog::EditCompleted, *this); RA_Colon2_Label.SetText(":"); RA_Second_Edit.SetMaxWidth(editWidth); RA_Second_Edit.SetText(IsoString(ra_hms.second)); RA_Second_Edit.OnEditCompleted( (Edit::edit_event_handler) &EditEqCoordPropertyDialog::EditCompleted, *this); DEC_Property_Label.SetMinWidth(labelWidth); DEC_Property_Label.SetText( "Dec (dd:mm:ss.ss)" ); DEC_Property_Label.SetTextAlignment(TextAlign::Left | TextAlign::VertCenter); DEC_Hour_Edit.SetMaxWidth(editWidth); DEC_Hour_Edit.SetText(IsoString(dec_hms.hour)); DEC_Hour_Edit.OnEditCompleted( (Edit::edit_event_handler) &EditEqCoordPropertyDialog::EditCompleted, *this); DEC_Colon1_Label.SetText( ":" ); DEC_Minute_Edit.SetMaxWidth(editWidth); DEC_Minute_Edit.SetText(IsoString(dec_hms.minute)); DEC_Minute_Edit.OnEditCompleted( (Edit::edit_event_handler) &EditEqCoordPropertyDialog::EditCompleted, *this); DEC_Colon2_Label.SetText( ":" ); DEC_Second_Edit.SetMaxWidth(editWidth); DEC_Second_Edit.SetText(IsoString(dec_hms.second)); DEC_Second_Edit.OnEditCompleted( (Edit::edit_event_handler) &EditEqCoordPropertyDialog::EditCompleted, *this); OK_PushButton.SetText( "OK" ); OK_PushButton.OnClick( (Button::click_event_handler) &EditEqCoordPropertyDialog::Ok_Button_Click, *this); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.OnClick( (Button::click_event_handler) &EditEqCoordPropertyDialog::Cancel_Button_Click, *this); RA_Property_Sizer.SetMargin(10); RA_Property_Sizer.SetSpacing(4); RA_Property_Sizer.Add(RA_Property_Label); RA_Property_Sizer.Add(RA_Hour_Edit); RA_Property_Sizer.Add(RA_Colon1_Label); RA_Property_Sizer.Add(RA_Minute_Edit); RA_Property_Sizer.Add(RA_Colon2_Label); RA_Property_Sizer.Add(RA_Second_Edit); RA_Property_Sizer.AddStretch(); DEC_Property_Sizer.SetMargin(10); DEC_Property_Sizer.SetSpacing(4); DEC_Property_Sizer.Add(DEC_Property_Label); DEC_Property_Sizer.Add(DEC_Hour_Edit); DEC_Property_Sizer.Add(DEC_Colon1_Label); DEC_Property_Sizer.Add(DEC_Minute_Edit); DEC_Property_Sizer.Add(DEC_Colon2_Label); DEC_Property_Sizer.Add(DEC_Second_Edit); DEC_Property_Sizer.AddStretch(); Buttons_Sizer.SetSpacing(4); Buttons_Sizer.AddSpacing(10); Buttons_Sizer.AddStretch(); Buttons_Sizer.Add(OK_PushButton); Buttons_Sizer.AddStretch(); Buttons_Sizer.Add(Cancel_PushButton); Buttons_Sizer.AddStretch(); Global_Sizer.Add(RA_Property_Sizer); Global_Sizer.Add(DEC_Property_Sizer); Global_Sizer.Add(Buttons_Sizer); SetSizer(Global_Sizer); }
HistogramAutoClipSetupDialog::HistogramAutoClipSetupDialog() : Dialog() { pcl::Font fnt = Font(); int labelWidth = fnt.Width( String( '0', 10 ) ); m_shadowsAutoClipping = TheHistogramTransformationInterface->m_shadowsAutoClipping; m_highlightsAutoClipping = TheHistogramTransformationInterface->m_highlightsAutoClipping; ShadowsAmount_NumericControl.label.SetText( "Shadows:" ); ShadowsAmount_NumericControl.label.SetFixedWidth( labelWidth ); ShadowsAmount_NumericControl.slider.SetScaledFixedWidth( 250 ); ShadowsAmount_NumericControl.slider.SetRange( 0, 200 ); ShadowsAmount_NumericControl.SetReal(); ShadowsAmount_NumericControl.SetRange( 0.0, 100.0 ); ShadowsAmount_NumericControl.SetPrecision( 3 ); ShadowsAmount_NumericControl.SetToolTip( "Shadows auto clipping amount" ); ShadowsAmount_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&HistogramAutoClipSetupDialog::__ClippingAmount_ValueUpdated, *this ); HighlightsAmount_NumericControl.label.SetText( "Highlights:" ); HighlightsAmount_NumericControl.label.SetFixedWidth( labelWidth ); HighlightsAmount_NumericControl.slider.SetScaledFixedWidth( 250 ); HighlightsAmount_NumericControl.slider.SetRange( 0, 200 ); HighlightsAmount_NumericControl.SetReal(); HighlightsAmount_NumericControl.SetRange( 0.0, 100.0 ); HighlightsAmount_NumericControl.SetPrecision( 3 ); HighlightsAmount_NumericControl.SetToolTip( "Highlights auto clipping amount" ); HighlightsAmount_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&HistogramAutoClipSetupDialog::__ClippingAmount_ValueUpdated, *this ); ClippingParameters_Sizer.SetMargin( 8 ); ClippingParameters_Sizer.SetSpacing( 6 ); ClippingParameters_Sizer.Add( ShadowsAmount_NumericControl ); ClippingParameters_Sizer.Add( HighlightsAmount_NumericControl ); ClippingParameters_GroupBox.SetTitle( "Clipping Amounts (Percentage of total pixels)" ); ClippingParameters_GroupBox.SetSizer( ClippingParameters_Sizer ); OK_PushButton.SetText( "OK" ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (Button::click_event_handler)&HistogramAutoClipSetupDialog::__Button_Click, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (Button::click_event_handler)&HistogramAutoClipSetupDialog::__Button_Click, *this ); Buttons_Sizer.SetSpacing( 8 ); Buttons_Sizer.AddStretch(); Buttons_Sizer.Add( OK_PushButton ); Buttons_Sizer.Add( Cancel_PushButton ); Global_Sizer.SetMargin( 8 ); Global_Sizer.SetSpacing( 6 ); Global_Sizer.Add( ClippingParameters_GroupBox ); Global_Sizer.AddSpacing( 4 ); Global_Sizer.Add( Buttons_Sizer ); SetSizer( Global_Sizer ); AdjustToContents(); SetFixedSize(); SetWindowTitle( "Histogram Auto Clipping Setup" ); OnReturn( (Dialog::return_event_handler)&HistogramAutoClipSetupDialog::__Dialog_Return, *this ); ShadowsAmount_NumericControl.SetValue( 100*m_shadowsAutoClipping ); HighlightsAmount_NumericControl.SetValue( 100*m_highlightsAutoClipping ); Update(); }
MultiViewSelectionDialog::MultiViewSelectionDialog( bool allowPreviews ) : Dialog(), m_selectedViews(), m_allowPreviews( allowPreviews ) { SetSizer( Global_Sizer ); Global_Sizer.SetMargin( 8 ); Global_Sizer.SetSpacing( 6 ); Global_Sizer.Add( Views_TreeBox ); Global_Sizer.Add( Row2_Sizer ); Row2_Sizer.SetSpacing( 8 ); Row2_Sizer.Add( SelectAll_PushButton ); Row2_Sizer.Add( UnselectAll_PushButton ); Row2_Sizer.AddStretch(); if ( m_allowPreviews ) { Row2_Sizer.Add( IncludePreviews_CheckBox ); Row2_Sizer.Add( IncludeMainViews_CheckBox ); } Global_Sizer.AddSpacing( 6 ); Global_Sizer.Add( Buttons_Sizer ); Buttons_Sizer.SetSpacing( 8 ); Buttons_Sizer.AddStretch(); Buttons_Sizer.Add( OK_PushButton ); Buttons_Sizer.Add( Cancel_PushButton ); Views_TreeBox.SetNumberOfColumns( 1 ); Views_TreeBox.HideHeader(); Views_TreeBox.DisableRootDecoration(); Views_TreeBox.EnableAlternateRowColor(); Views_TreeBox.SetScaledMinHeight( 300 ); SelectAll_PushButton.SetText( "Select All" ); SelectAll_PushButton.OnClick( (Button::click_event_handler)&MultiViewSelectionDialog::ButtonClick, *this ); UnselectAll_PushButton.SetText( "Unselect All" ); UnselectAll_PushButton.OnClick( (Button::click_event_handler)&MultiViewSelectionDialog::ButtonClick, *this ); if ( m_allowPreviews ) { IncludeMainViews_CheckBox.SetText( "Main views" ); IncludeMainViews_CheckBox.SetToolTip( "<p>Include main views in the list of selectable views.</p>" ); IncludeMainViews_CheckBox.OnClick( (Button::click_event_handler)&MultiViewSelectionDialog::OptionClick, *this ); IncludeMainViews_CheckBox.SetChecked(); IncludePreviews_CheckBox.SetText( "Previews" ); IncludePreviews_CheckBox.SetToolTip( "<p>Include previews in the list of selectable views.</p>" ); IncludePreviews_CheckBox.OnClick( (Button::click_event_handler)&MultiViewSelectionDialog::OptionClick, *this ); IncludePreviews_CheckBox.SetChecked(); } else { IncludeMainViews_CheckBox.Hide(); IncludePreviews_CheckBox.Hide(); } OK_PushButton.SetText( "OK" ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (Button::click_event_handler)&MultiViewSelectionDialog::ButtonClick, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (Button::click_event_handler)&MultiViewSelectionDialog::ButtonClick, *this ); SetWindowTitle( "Select Views" ); OnShow( (Control::event_handler)&MultiViewSelectionDialog::ControlShow, *this ); Regenerate(); }
TIFFRangeOptionsDialog::TIFFRangeOptionsDialog( const TIFFFormat::OutOfRangePolicyOptions& options, int bitsPerSample, double minSampleValue, double maxSampleValue ) : Dialog(), outOfRange( options ) { if ( maxSampleValue < minSampleValue ) Swap( minSampleValue, maxSampleValue ); TIFFFormat::OutOfRangePolicyOptions o = TIFFFormat::DefaultOutOfRangePolicyOptions(); int labelWidth = Font().Width( String( "If out of range:" ) + 'M' ); // Info_Label.EnableWordWrapping(); Info_Label.EnableRichText(); Info_Label.SetText( "<p>This TIFF file stores a " + String( bitsPerSample ) + "-bit floating point image.<br>" "Its extreme pixel sample values are:</p>" "<p style=\"white-space:pre;\"><pre>" + String().Format( "Minimum: %+.15g", minSampleValue ) + "<br>" + String().Format( "Maximum: %+.15g", maxSampleValue ) + "</pre></p>" "<p>Please specify a range of values to correctly interpret existing pixel values in this image. " "The lower and upper range bounds below correspond to the limits of the available dynamic range in the " "context of this TIFF image. PixInsight will use these limits to scale pixel values to the normalized " "[0,1] range, where zero represents black and one represents white.</p>" ); // LowerRange_NumericEdit.label.SetText( "Lower Range:" ); LowerRange_NumericEdit.label.SetFixedWidth( labelWidth ); LowerRange_NumericEdit.SetReal( true ); LowerRange_NumericEdit.SetRange( -DBL_MAX, +DBL_MAX ); LowerRange_NumericEdit.SetPrecision( 15 ); LowerRange_NumericEdit.EnableScientificNotation(); LowerRange_NumericEdit.SetScientificNotationTriggerExponent( 5 ); LowerRange_NumericEdit.sizer.AddStretch(); LowerRange_NumericEdit.SetToolTip( "<p>Lower range of input floating point pixel samples.</p>" ); LowerRange_NumericEdit.SetValue( o.lowerRange ); UpperRange_NumericEdit.label.SetText( "Upper Range:" ); UpperRange_NumericEdit.label.SetFixedWidth( labelWidth ); UpperRange_NumericEdit.SetReal( true ); UpperRange_NumericEdit.SetRange( -DBL_MAX, +DBL_MAX ); UpperRange_NumericEdit.SetPrecision( 15 ); UpperRange_NumericEdit.EnableScientificNotation(); UpperRange_NumericEdit.SetScientificNotationTriggerExponent( 5 ); UpperRange_NumericEdit.sizer.AddStretch(); UpperRange_NumericEdit.SetToolTip( "<p>Upper range of input floating point pixel samples.</p>" ); UpperRange_NumericEdit.SetValue( o.upperRange ); ReadRescaleMode_Label.SetText( "If out-of-range:" ); ReadRescaleMode_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter ); ReadRescaleMode_Label.SetMinWidth( labelWidth ); ReadRescaleMode_ComboBox.AddItem( "Rescale image to the specified range" ); ReadRescaleMode_ComboBox.AddItem( "Truncate all out-of-range values" ); ReadRescaleMode_ComboBox.SetToolTip( "<p>This parameter tells how to fix input pixel samples whose values " "exceed the specified input range.</p>" ); ReadRescaleMode_ComboBox.SetCurrentItem( outOfRange.outOfRangeFixMode ); ReadRescaleMode_Sizer.SetSpacing( 4 ); ReadRescaleMode_Sizer.Add( ReadRescaleMode_Label ); ReadRescaleMode_Sizer.Add( ReadRescaleMode_ComboBox, 100 ); ReadRange_Sizer.SetMargin( 6 ); ReadRange_Sizer.SetSpacing( 4 ); ReadRange_Sizer.Add( LowerRange_NumericEdit ); ReadRange_Sizer.Add( UpperRange_NumericEdit ); ReadRange_Sizer.Add( ReadRescaleMode_Sizer ); ReadRange_GroupBox.SetTitle( "Floating Point Input Range" ); ReadRange_GroupBox.SetSizer( ReadRange_Sizer ); // OK_PushButton.SetText( "OK" ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (pcl::Button::click_event_handler)&TIFFRangeOptionsDialog::Button_Click, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&TIFFRangeOptionsDialog::Button_Click, *this ); BottomSection_Sizer.SetSpacing( 8 ); BottomSection_Sizer.AddStretch(); BottomSection_Sizer.Add( OK_PushButton ); BottomSection_Sizer.Add( Cancel_PushButton ); // Global_Sizer.SetMargin( 8 ); Global_Sizer.Add( Info_Label ); Global_Sizer.AddSpacing( 12 ); Global_Sizer.Add( ReadRange_GroupBox ); Global_Sizer.AddSpacing( 12 ); Global_Sizer.Add( BottomSection_Sizer ); SetSizer( Global_Sizer ); SetWindowTitle( "TIFF Floating Point Range Options" ); OnShow( (Control::event_handler)&TIFFRangeOptionsDialog::Control_Show, *this ); OnReturn( (Dialog::return_event_handler)&TIFFRangeOptionsDialog::Dialog_Return, *this ); }