void MainPropGrid::RefreshValues() { wxWindowUpdateLocker noUpdates(this); //Bloque la mise à jour de l'affichage for(int i=0;i<this->dataItems.size();i++) { this->dataItems[i].elementItem->UpdateValue(this,this->dataItems[i].rowNumber); } }
void MainPropGrid::LoadElement(Element* elementToShowProp) { wxWindowUpdateLocker noUpdates(this); //Bloque la mise à jour de l'affichage this->CloseElement(); CurrentElement=elementToShowProp; this->XmlIdElement=elementToShowProp->GetXmlId(); CurrentElement->AppendWitness(LifeTimeWitness(new MainPropGridWitness(this,CurrentElement->GetXmlId()))); this->SetColLabelValue(0,elementToShowProp->GetColTitle(0)); this->idCurrentElement=elementToShowProp->GetElementInfos().idElement; elementToShowProp->InitProp(); std::list<Element*> filsNoeud; elementToShowProp->GetChildElement(filsNoeud); //std::sort(filsNoeud.begin( ), filsNoeud.end( ), GridSortPredicate ); filsNoeud.sort(GridSortPredicate); for(std::list<Element*>::iterator itfils=filsNoeud.begin();itfils!=filsNoeud.end();itfils++) { const Element::t_elementInfo& elinfos=(*itfils)->GetElementInfos(); if(!elinfos.hidden && elinfos.typeElement!=Element::ELEMENT_TYPE_POSITION) { E_Data* elementFils=dynamic_cast<E_Data*>((*itfils)); if(elementFils) //Si il s'agit d'un objet dérivé de data { try { rowInfo rowToAdd; rowToAdd.elementItem=elementFils; this->AppendRows(1); rowToAdd.rowNumber=this->GetNumberRows()-1; this->dataItems.push_back(rowToAdd); elementFils->FillWxGrid(this); AutoSizeLibelle(this->GetNumberRows()-1); } catch( ... ) { wxLogDebug(_("Error in loading properties")); break; } } } } //Redimensionnement AutoSizeColumns(false); //AutoSizeRows(false); this->SetRowLabelSize(wxGRID_AUTOSIZE); this->SetColLabelSize(wxGRID_AUTOSIZE); //ForceRefresh(); //AutoSize ( ) ; }
void ChatPanel::SetLogFile(const wxString& name) { m_chat_log.SetLogFile(name); if (name.empty()) { return; } wxWindowUpdateLocker noUpdates(m_chatlog_text); wxArrayString lines = m_chat_log.GetLastLines(); const size_t num_lines = sett().GetAutoloadedChatlogLinesCount(); const size_t start = std::max<size_t>(0, lines.Count() - num_lines); for (size_t i = start; i < lines.Count(); ++i) { OutputLine(lines[i], sett().GetChatColorServer(), false); } }
Image::Image(ImageOwner* _owner) { owner = _owner; loader = 0; loaderPlane = 0; original = 0; loaderScanline = 0; fullyDecoded = false; inError = false; width = height = 0; animationAdvice = KHTMLSettings::KAnimationEnabled; noUpdates(); }
void ChatPanel::LoadLastLines() { #ifdef __WXMSW__ wxWindowUpdateLocker noUpdates(m_chatlog_text); #endif wxArrayString lines = m_chat_log.GetLastLines( ); wxFont f = m_chatlog_text->GetFont(); f.SetFamily( wxFONTFAMILY_DECORATIVE ); f.SetStyle( wxFONTSTYLE_ITALIC ); wxTextAttr chatstyle( sett().GetChatColorTime(), sett().GetChatColorBackground(), f ); m_chatlog_text->SetDefaultStyle( chatstyle ); for ( size_t i = 0; i < lines.Count(); ++i ) { m_chatlog_text->AppendText( lines[i] ); m_chatlog_text->AppendText( _T( "\n" ) ); } }
void MainPropGrid::OnBuildDiagram(wxCommandEvent& event) { //Ouverture de l'interface de création de graphique wxAuiManager* currentManager=wxAuiManager::GetManager(this); if(currentManager) { DataWindow* newWindow=new DataWindow(this->GetParent() ,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_EXTERNAL_MOVE ); wxWindowUpdateLocker noUpdates(newWindow); //Bloque la mise à jour de l'affichage currentManager->AddPane(newWindow, wxAuiPaneInfo(). Caption(_("Spreadsheet")+wxString(" - ")+CurrentElement->GetElementInfos().libelleElement).FloatingSize(300,200) .Float().CloseButton(true).MaximizeButton(true).DestroyOnClose(true)); //Création du dialogue BuildGraphSheetDialog* sgCreatorDialog=new BuildGraphSheetDialog(this->GetParent(),newWindow,wxID_ANY,_("New diagram")); //Ajout des données séléctionnées std::vector<wxString> lblCols(currentSelection.RightCol-currentSelection.LeftCol+1); std::vector<wxString> lblRows(currentSelection.BottomRow-currentSelection.TopRow+1); std::vector<float> cellsValue(lblCols.size()*lblRows.size()); wxInt32 zeroBaseRow=0; for ( int row = currentSelection.TopRow; row <= currentSelection.BottomRow; row++ ) { lblRows[zeroBaseRow]=this->GetRowLabelValue(row); wxInt32 zeroBaseCol=0; for ( int col = currentSelection.LeftCol; col <= currentSelection.RightCol; col++ ) { if(row==currentSelection.TopRow) lblCols[zeroBaseCol]=this->GetColLabelValue(col); double valCell=0; this->GetCellValue(row,col).ToDouble(&valCell) ; cellsValue[(zeroBaseCol*lblRows.size())+zeroBaseRow]=valCell; zeroBaseCol++; } zeroBaseRow++; } sgCreatorDialog->LoadData(lblCols,lblRows,cellsValue); sgCreatorDialog->ShowModal(); currentManager->Update(); } }
void QtTestApp::initUpdater() { createUpdaterWindow(); FvUpdater::sharedUpdater()->SetFeedURL("https://raw.github.com/ershovdz/WebMounter_Builds/master/Appcast.xml"); // signals from WINDOW connect(m_updaterWindow, SIGNAL(installRequested()), FvUpdater::sharedUpdater(), SLOT(InstallUpdate())); connect(m_updaterWindow, SIGNAL(skipInstallRequested()), FvUpdater::sharedUpdater(), SLOT(SkipUpdate())); connect(m_updaterWindow, SIGNAL(remindLaterRequested()), FvUpdater::sharedUpdater(), SLOT(RemindMeLater())); connect(m_updaterWindow, SIGNAL(cancelRequested()), FvUpdater::sharedUpdater(), SLOT(CancelUpdate())); // signals from UPDATER connect(FvUpdater::sharedUpdater(), SIGNAL(finished()), m_updaterWindow, SLOT(onFinished())); connect(FvUpdater::sharedUpdater(), SIGNAL(failed(QString)), m_updaterWindow, SLOT(onFailed(QString))); connect(FvUpdater::sharedUpdater(), SIGNAL(progress(uint)), m_updaterWindow, SLOT(onProgress(uint))); connect(FvUpdater::sharedUpdater(), SIGNAL(updateAvailable(FvAvailableUpdate*)), this, SLOT(onUpdates(FvAvailableUpdate*))); connect(FvUpdater::sharedUpdater(), SIGNAL(noUpdates()), this, SLOT(onNoUpdates())); connect(FvUpdater::sharedUpdater(), SIGNAL(closeAppToRunInstaller()), this, SLOT(onCloseApp())); }
/* Create a Screenshot of the current 3D view. * Output file format is png or jpeg, or image is copied to the clipboard */ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event ) { wxFileName fn( Parent()->GetDefaultFileName() ); wxString FullFileName; wxString file_ext, mask; bool fmt_is_jpeg = false; if( event.GetId() == ID_MENU_SCREENCOPY_JPEG ) fmt_is_jpeg = true; if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD ) { file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" ); mask = wxT( "*." ) + file_ext; FullFileName = Parent()->GetDefaultFileName(); fn.SetExt( file_ext ); FullFileName = EDA_FileSelector( _( "3D Image filename:" ), wxEmptyString, fn.GetFullName(), file_ext, mask, this, wxFD_SAVE, true ); if( FullFileName.IsEmpty() ) return; // Be sure the screen area destroyed by the file dialog is redrawn before making // a screen copy. // Without this call, under Linux the screen refresh is made to late. wxYield(); } struct vieport_params { GLint originx; GLint originy; GLint x; GLint y; } viewport; // Build image from the 3D buffer wxWindowUpdateLocker noUpdates( this ); glGetIntegerv( GL_VIEWPORT, (GLint*) &viewport ); unsigned char* pixelbuffer = (unsigned char*) malloc( viewport.x * viewport.y * 3 ); unsigned char* alphabuffer = (unsigned char*) malloc( viewport.x * viewport.y ); wxImage image( viewport.x, viewport.y ); glPixelStorei( GL_PACK_ALIGNMENT, 1 ); glReadBuffer( GL_BACK_LEFT ); glReadPixels( viewport.originx, viewport.originy, viewport.x, viewport.y, GL_RGB, GL_UNSIGNED_BYTE, pixelbuffer ); glReadPixels( viewport.originx, viewport.originy, viewport.x, viewport.y, GL_ALPHA, GL_UNSIGNED_BYTE, alphabuffer ); image.SetData( pixelbuffer ); image.SetAlpha( alphabuffer ); image = image.Mirror( false ); wxBitmap bitmap( image ); if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD ) { wxBitmapDataObject* dobjBmp = new wxBitmapDataObject; dobjBmp->SetBitmap( bitmap ); if( wxTheClipboard->Open() ) { if( !wxTheClipboard->SetData( dobjBmp ) ) wxMessageBox( _( "Failed to copy image to clipboard" ) ); wxTheClipboard->Flush(); /* the data in clipboard will stay * available after the * application exits */ wxTheClipboard->Close(); } } else { wxImage image = bitmap.ConvertToImage(); if( !image.SaveFile( FullFileName, fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) ) wxMessageBox( _( "Can't save file" ) ); image.Destroy(); } }
void VPModelWindow::UpdateWindowKindFromFlags() { // Validate pointers. ValidateThis_(); // Look for window kind and flag attributes. FindIntegerAttribute // validates the pointers before returning them, so there's no need // to revalidate. DMIntegerAttribute* wdefAttr = FindIntegerAttribute(pPaneWindowProc); SInt32 wdef = wdefAttr->GetIntValue(); DMIntegerAttribute* sizeAttr = FindIntegerAttribute(pPaneWindowSizeBox); DMIntegerAttribute* zoomAttr = FindIntegerAttribute(pPaneWindowZoomable); SInt32 size = sizeAttr->GetIntValue(); SInt32 zoom = zoomAttr->GetIntValue(); // Prevent recursion by disabling UpdateWindowFlagsFromKind. StValueChanger<Boolean> noUpdates(mSuppressKindUpdates, true); // Dispatch by window kind. switch (wdef) { // Regular document window: case noGrowDocProc: // z g case documentProc: // z G case zoomNoGrow: // Z g case zoomDocProc: // Z G if (zoom) wdefAttr->SetIntValue(size ? zoomDocProc : zoomNoGrow); else wdefAttr->SetIntValue(size ? documentProc : noGrowDocProc); break; // Floating windows (side title): case floatSideProc: // z g case floatSideGrowProc: // z G case floatSideZoomProc: // Z g case floatSideZoomGrowProc: // Z G if (zoom) wdefAttr->SetIntValue(size ? floatSideZoomGrowProc : floatSideZoomProc); else wdefAttr->SetIntValue(size ? floatSideGrowProc : floatSideProc); break; // Floating windows (top title): case floatProc: // z g case floatGrowProc: // z G case floatZoomProc: // Z g case floatZoomGrowProc: // Z G if (zoom) wdefAttr->SetIntValue(size ? floatZoomGrowProc : floatZoomProc); else wdefAttr->SetIntValue(size ? floatGrowProc : floatProc); break; } }
void VPModelWindow::UpdateWindowFlagsFromKind( Boolean inUpdateCloseBox) { // Validate pointers. ValidateThis_(); // Look for window kind and flag attributes. FindIntegerAttribute // validates the pointers before returning them, so there's no need // to revalidate. DMIntegerAttribute* wdefAttr = FindIntegerAttribute(pPaneWindowProc); SInt32 wdef = wdefAttr->GetIntValue(); DMIntegerAttribute* close = FindIntegerAttribute(pPaneWindowCloseBox); DMIntegerAttribute* title = FindIntegerAttribute(pPaneWindowTitleBar); DMIntegerAttribute* resize = FindIntegerAttribute(pPaneWindowResizable); DMIntegerAttribute* size = FindIntegerAttribute(pPaneWindowSizeBox); DMIntegerAttribute* zoom = FindIntegerAttribute(pPaneWindowZoomable); // Prevent recursion by disabling UpdateWindowKindFromFlags. StValueChanger<Boolean> noUpdates(mSuppressSizeUpdates, true); // Dispatch by window kind. switch (wdef) { // Regular document windows (and all others): case noGrowDocProc: // z g case documentProc: // z G case zoomNoGrow: // Z g case zoomDocProc: // Z G close->Enable(); title->Disable(); resize->Enable(); size->Enable(); zoom->Enable(); if (inUpdateCloseBox) close->SetIntValue(1); title->SetIntValue(1); resize->SetIntValue(wdef == documentProc || wdef == zoomDocProc); size->SetIntValue(wdef == documentProc || wdef == zoomDocProc); zoom->SetIntValue(wdef == zoomNoGrow || wdef == zoomDocProc); break; // Movable modal dialog: case movableDBoxProc: close->Disable(); title->Disable(); resize->Disable(); size->Disable(); zoom->Disable(); close->SetIntValue(0); title->SetIntValue(1); resize->SetIntValue(0); size->SetIntValue(0); zoom->SetIntValue(0); break; // Regular modal dialog: case dBoxProc: case plainDBox: case altDBoxProc: close->Disable(); title->Disable(); resize->Disable(); size->Disable(); zoom->Disable(); close->SetIntValue(0); title->SetIntValue(0); resize->SetIntValue(0); size->SetIntValue(0); zoom->SetIntValue(0); break; // Round document window: #if CALL_NOT_IN_CARBON || UNIVERSAL_INTERFACES_VERSION < 0x0337 case rDocProc: #else case 16: // icw -- rDocProc isn't available in Carbon #endif close->Enable(); title->Disable(); resize->Disable(); size->Disable(); zoom->Enable(); if (inUpdateCloseBox) close->SetIntValue(1); title->SetIntValue(1); resize->SetIntValue(0); size->SetIntValue(0); zoom->SetIntValue(0); break; // Floating window (top title bar): case floatProc: // z g case floatGrowProc: // z G case floatZoomProc: // Z g case floatZoomGrowProc: // Z G close->Enable(); title->Enable(); resize->Enable(); size->Enable(); zoom->Enable(); if (inUpdateCloseBox) close->SetIntValue(1); title->SetIntValue(1); resize->SetIntValue(wdef == floatGrowProc || wdef == floatZoomGrowProc); size->SetIntValue(wdef == floatGrowProc || wdef == floatZoomGrowProc); zoom->SetIntValue(wdef == floatZoomGrowProc || wdef == floatZoomProc); break; // Floating window (side title bar): case floatSideProc: // z g case floatSideGrowProc: // z G case floatSideZoomProc: // Z g case floatSideZoomGrowProc: // Z G close->Enable(); title->Enable(); resize->Enable(); size->Enable(); zoom->Enable(); if (inUpdateCloseBox) close->SetIntValue(1); title->SetIntValue(1); resize->SetIntValue(wdef == floatSideGrowProc || wdef == floatSideZoomGrowProc); size->SetIntValue(wdef == floatSideGrowProc || wdef == floatSideZoomGrowProc); zoom->SetIntValue(wdef == floatSideZoomGrowProc || wdef == floatSideZoomProc); break; // Unknown: default: close->Enable(); title->Enable(); resize->Enable(); size->Enable(); zoom->Enable(); } }
void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event ) { wxString fullFileName; bool fmt_is_jpeg = false; if( event.GetId() == ID_MENU_SCREENCOPY_JPEG ) fmt_is_jpeg = true; if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD ) { // Remember path between saves during this session only. static wxFileName fn; const wxString file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" ); const wxString mask = wxT( "*." ) + file_ext; // First time path is set to the project path. if( !fn.IsOk() ) fn = Parent()->Prj().GetProjectFullName(); fn.SetExt( file_ext ); fullFileName = EDA_FILE_SELECTOR( _( "3D Image File Name:" ), fn.GetPath(), m_defaultFileName, file_ext, mask, this, wxFD_SAVE | wxFD_OVERWRITE_PROMPT, true ); if( fullFileName.IsEmpty() ) return; fn = fullFileName; // Be sure the screen area destroyed by the file dialog is redrawn // before making a screen copy. // Without this call, under Linux the screen refresh is made to late. wxYield(); } // Be sure we have the latest 3D view (remember 3D view is buffered) Refresh(); wxYield(); // Build image from the 3D buffer wxWindowUpdateLocker noUpdates( this ); wxImage screenshotImage; if( m_canvas ) m_canvas->GetScreenshot( screenshotImage ); if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD ) { wxBitmap bitmap( screenshotImage ); if( wxTheClipboard->Open() ) { wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap ); if( !wxTheClipboard->SetData( dobjBmp ) ) wxMessageBox( _( "Failed to copy image to clipboard" ) ); wxTheClipboard->Flush(); /* the data in clipboard will stay * available after the application exits */ wxTheClipboard->Close(); } } else { if( !screenshotImage.SaveFile( fullFileName, fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) ) wxMessageBox( _( "Can't save file" ) ); screenshotImage.Destroy(); } }
void ChatPanel::OutputLine( const ChatLine& line ) { int pos = m_chatlog_text->GetScrollPos(wxVERTICAL); int end = m_chatlog_text->GetScrollRange(wxVERTICAL); int thumb = m_chatlog_text->GetScrollThumb(wxVERTICAL); #ifndef __WXMSW__ float original_pos = (float)(pos+thumb) / (float)end; #else int size = m_chatlog_text->GetSize().GetHeight(); float original_pos = (float)(pos+size) / (float)end; // wxmsw is retarded and reports thumb size as 0 always #endif if ( original_pos < 0.0f ) original_pos = 0.0f; if ( original_pos > 1.0f ) original_pos = 1.0f; // this is necessary because the code in windows isn't 100% right because thumb always returns 0 long original_line = 0; #ifndef __WXMSW__ if (original_pos < 1.0f ) { original_line = (long)(original_pos *(float)m_chatlog_text->GetNumberOfLines()); // GetNumberOfLines is expensive, only call when necessary m_chatlog_text->Freeze(); } #else wxWindowUpdateLocker noUpdates(m_chatlog_text); // use the automatic one in windows #endif m_chatlog_text->SetDefaultStyle( line.timestyle ); m_chatlog_text->AppendText( line.time ); m_chatlog_text->SetDefaultStyle( line.chatstyle ); #ifndef __WXOSX_COCOA__ if ( sett().GetUseIrcColors() ) { wxString m1; wxString m2; wxString m3; wxTextAttr at; int oldweight; char c; int color; m1 = line.chat; bool _2chars = false; bool bold = false; wxFont font; wxColor curcolor(0,0,0); wxColor oldcolor(0,0,0); curcolor = line.chatstyle.GetTextColour(); at = m_chatlog_text->GetDefaultStyle(); font = at.GetFont(); oldweight = font.GetWeight(); oldcolor = line.chatstyle.GetTextColour(); while ( m1.Len() > 0 ) { c = m1.GetChar(0); if (c == 3 && m1.Len() > 1 && (m1.GetChar(1) >= 48 && m1.GetChar(1) <= 58)) // Color { if (m1.Len() > 2 && (m1.GetChar(2) >= 48 && m1.GetChar(2) <= 58)) { color = (int(m1.GetChar(1)) - 48)*10+(int(m1.GetChar(2)) - 48); _2chars = true; m1 = m1.Mid(3); } else { color = int(m1.GetChar(1)) -48; _2chars = false; m1 = m1.Mid(2); } wxColor dummy(0,0,0); if ( ( color > -1 ) && ( color < long(( sizeof( m_irc_colors ) / sizeof( dummy ) )) ) ) { curcolor = m_irc_colors[color]; } }else if(c == 2)//Bold { bold = !bold; m1 = m1.Mid(1); }else if(c == 0x0F) //Reset formatting { bold = false; curcolor = oldcolor; m1 = m1.Mid(1); }else{ at = m_chatlog_text->GetDefaultStyle(); at.SetFlags(wxTEXT_ATTR_TEXT_COLOUR | wxTEXT_ATTR_FONT_WEIGHT); font = at.GetFont(); if (bold) font.SetWeight(wxFONTWEIGHT_BOLD); else font.SetWeight(oldweight); at.SetFont(font); at.SetTextColour(curcolor); m_chatlog_text->SetDefaultStyle(at); m_chatlog_text->AppendText( m1.Mid(0,1) ); m1 = m1.Mid(1); } } if (bold) { font = at.GetFont(); font.SetWeight(oldweight); at.SetFont(font); m_chatlog_text->SetDefaultStyle(at); } } else #endif { m_chatlog_text->AppendText( line.chat ); } m_chatlog_text->AppendText( _T( "\n" ) ); // crop lines from history that exceeds limit int maxlenght = sett().GetChatHistoryLenght(); if ( ( maxlenght > 0 ) && ( m_chatlog_text->GetNumberOfLines() > sett().GetChatHistoryLenght() ) ) { int end_line = 0; for ( int i = 0; i < 20; i++ ) end_line += m_chatlog_text->GetLineLength( i ) + 1; m_chatlog_text->Remove( 0, end_line ); } if (original_pos < 1.0f) { #ifndef __WXMSW__ wxString linetext = m_chatlog_text->GetLineText(original_line); long zoomto = m_chatlog_text->GetValue().Find(linetext); m_chatlog_text->ShowPosition( zoomto ); // wxgtk is retarded and always autoscrolls #endif } else { m_chatlog_text->ScrollLines(10); // wx is retarded, necessary to show the latest line #ifdef __WXMSW__ m_chatlog_text->ShowPosition( m_chatlog_text->GetLastPosition() ); #endif } this->Refresh(); #ifndef __WXMSW__ if (original_pos < 1.0f) { m_chatlog_text->Thaw(); } #endif }
void Image::notifyPerformUpdate() { owner->imageChange(this, QRect(0, updatesStartLine, width, updatesEndLine - updatesStartLine + 1)); noUpdates(); }