static void browse_draw_info(struct dir *dr) { struct dir *t; int i; nccreate(11, 60, "Item info"); if(dr->hlnk) { if(info_page == 0) attron(A_REVERSE); ncaddstr(0, 41, "1:Info"); attroff(A_REVERSE); if(info_page == 1) attron(A_REVERSE); ncaddstr(0, 50, "2:Links"); attroff(A_REVERSE); } switch(info_page) { case 0: attron(A_BOLD); ncaddstr(2, 3, "Name:"); ncaddstr(3, 3, "Path:"); ncaddstr(4, 3, "Type:"); ncaddstr(6, 3, " Disk usage:"); ncaddstr(7, 3, "Apparent size:"); attroff(A_BOLD); ncaddstr(2, 9, cropstr(dr->name, 49)); ncaddstr(3, 9, cropstr(getpath(dr->parent), 49)); ncaddstr(4, 9, dr->flags & FF_DIR ? "Directory" : dr->flags & FF_FILE ? "File" : "Other (link, device, socket, ..)"); ncprint(6, 18, "%s (%s B)", formatsize(dr->size), fullsize(dr->size)); ncprint(7, 18, "%s (%s B)", formatsize(dr->asize), fullsize(dr->asize)); break; case 1: for(i=0,t=dr->hlnk; t!=dr; t=t->hlnk,i++) { if(info_start > i) continue; if(i-info_start > 5) break; ncaddstr(2+i-info_start, 3, cropstr(getpath(t), 54)); } if(t!=dr) ncaddstr(8, 25, "-- more --"); break; } ncaddstr(9, 32, "Press i to hide this window"); }
void SettingsGuidingCalibrateDlg::OnvideoPanelLeftDown(wxMouseEvent& event) { // mouse event is must be re-enabled by user if needed DisconnectMouseEvent(); wxWebcam* camera = wxF()->webcam(); if (!camera) return; wxImage* image = camera->liveImage(); if(!image->IsOk())return; int guideBoxSize,bacgroundCutoff,guideInterval; double imageScale, cameraAngle; wxGuidingConfig::getGuidingConfig(guideBoxSize,bacgroundCutoff,guideInterval,imageScale,cameraAngle); // obviously, we must override the parameters that we are supposed to calculate cameraAngle = 0.0; imageScale = 1.0; m_normal = false; // will be set to true if the calibration appears successful // we also override the guide interval to get sufficient resolution in the calibration guideInterval = 200; // [ms] m_guide_subframe.setCameraAngle(cameraAngle); m_guide_subframe.setImageScale(imageScale); m_guide_subframe.setCutoffLimit(bacgroundCutoff); // get position and guide box size wxPoint DC_point = event.GetPosition(); wxSize subsiz(guideBoxSize,guideBoxSize); // convert to image coordinates and enable the guide box display wxRealPoint imagePoint; camera->imagePointfromDC(DC_point,imagePoint); camera->setGuideBox(imagePoint,imagePoint,subsiz); // init the subframe wxSize fullsize(image->GetWidth(),image->GetHeight()); m_guide_subframe.setFrameInfo(fullsize,subsiz,imagePoint); bool inverted = camera->liveImageInverted(); // lock onto the guidestar bool locked = false; if(image && m_guide_subframe.copySubFrame(*image,inverted)) { // lock on the selected guide star wxStar offset_star; if(m_guide_subframe.guide(offset_star)) { // Initialise the offset position to be the same as the lock position // by declaring that the offset is zero m_offset_star = wxStar(0.0,0.0,0.0); // just a simple timer loop to drive the guiding m_guide_timer.Start(guideInterval); locked = true; // the stopwatch will be started when movement is detected m_stop_watch_started = false; } } }