Beispiel #1
0
void ClangDriver::DoParseCompletionString(CXCompletionString str,
        int depth,
        wxString& entryName,
        wxString& signature,
        wxString& completeString,
        wxString& returnValue)
{

    bool collectingSignature = false;
    int numOfChunks = clang_getNumCompletionChunks(str);
    for(int j = 0; j < numOfChunks; j++) {

        CXString chunkText = clang_getCompletionChunkText(str, j);
        CXCompletionChunkKind chunkKind = clang_getCompletionChunkKind(str, j);

        switch(chunkKind) {
        case CXCompletionChunk_TypedText:
            entryName = wxString(clang_getCString(chunkText), wxConvUTF8);
            completeString += entryName;
            break;

        case CXCompletionChunk_ResultType:
            completeString += wxString(clang_getCString(chunkText), wxConvUTF8);
            completeString += wxT(" ");
            returnValue = wxString(clang_getCString(chunkText), wxConvUTF8);
            break;

        case CXCompletionChunk_Optional: {
            // Optional argument
            CXCompletionString optStr = clang_getCompletionChunkCompletionString(str, j);
            wxString optionalString;
            wxString dummy;
            // Once we hit the 'Optional Chunk' only the 'completeString' is matter
            DoParseCompletionString(optStr, depth + 1, dummy, dummy, optionalString, dummy);
            if(collectingSignature) {
                signature += optionalString;
            }
            completeString += optionalString;
        }
        break;
        case CXCompletionChunk_LeftParen:
            collectingSignature = true;
            signature += wxT("(");
            completeString += wxT("(");
            break;

        case CXCompletionChunk_RightParen:
            collectingSignature = true;
            signature += wxT(")");
            completeString += wxT(")");
            break;

        default:
            if(collectingSignature) {
                signature += wxString(clang_getCString(chunkText), wxConvUTF8);
            }
            completeString += wxString(clang_getCString(chunkText), wxConvUTF8);
            break;
        }
        clang_disposeString(chunkText);
    }

    // To make this tag compatible with ctags one, we need to place
    // a /^ and $/ in the pattern string (we add this only to the top level completionString)
    if(depth == 0) {
        completeString.Prepend(wxT("/^ "));
        completeString.Append(wxT(" $/"));
    }
}
frmDatabaseDesigner::frmDatabaseDesigner(frmMain *form, const wxString &_title, pgConn *conn)
	: pgFrame(NULL, _title)
{
	mainForm = form;
	SetTitle(wxT("Database Designer"));
	SetIcon(wxIcon(*ddmodel_32_png_ico));
	loading = true;
	closing = false;

	RestorePosition(100, 100, 600, 500, 450, 300);
	SetMinSize(wxSize(450, 300));

	// connection
	connection = conn;

	// notify wxAUI which frame to use
	manager.SetManagedWindow(this);
	manager.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_TRANSPARENT_DRAG);

	wxWindowBase::SetFont(settings->GetSystemFont());

	// Set File menu
	fileMenu = new wxMenu();
	fileMenu->Append(MNU_NEW, _("&New database design\tCtrl-N"), _("Create a new database design"));
	fileMenu->AppendSeparator();
	fileMenu->Append(MNU_LOADMODEL, _("&Open Model..."), _("Open an existing database design from a file"));
	fileMenu->Append(MNU_SAVEMODEL, _("&Save Model"), _("Save changes at database design"));
	fileMenu->Append(MNU_SAVEMODELAS, _("&Save Model As..."), _("Save database design at new file"));
	fileMenu->AppendSeparator();
	fileMenu->Append(CTL_IMPSCHEMA, _("&Import Tables..."), _("Import tables from database schema to database designer model"));
	fileMenu->AppendSeparator();
	fileMenu->Append(MNU_EXIT, _("E&xit\tCtrl-W"), _("Exit database designer window"));

	// Set Diagram menu
	diagramMenu = new wxMenu();
	diagramMenu->Append(MNU_NEWDIAGRAM, _("&New model diagram"), _("Create a new diagram"));
	diagramMenu->Append(MNU_DELDIAGRAM, _("&Delete selected model diagram..."), _("Delete selected diagram"));
	diagramMenu->Append(MNU_RENDIAGRAM, _("&Rename selected model diagram..."), _("Rename selected diagram"));

	// Set View menu
	viewMenu = new wxMenu();
	viewMenu->AppendCheckItem(MNU_TOGGLEMBROWSER, _("&Model Browser"), _("Show / Hide Model Browser Window"));
	viewMenu->AppendCheckItem(MNU_TOGGLEDDSQL, _("&SQL Window"), _("Show / Hide SQL Window"));
	viewMenu->Check(MNU_TOGGLEDDSQL, true);
	viewMenu->Check(MNU_TOGGLEMBROWSER, true);

	// Set Help menu
	helpMenu = new wxMenu();
	helpMenu->Append(MNU_CONTENTS, _("&Help"), _("Open the helpfile."));
	helpMenu->Append(MNU_HELP, _("&SQL Help\tF1"), _("Display help on SQL commands."));

	// Set menu bar
	menuBar = new wxMenuBar();
	menuBar->Append(fileMenu, _("&File"));
	menuBar->Append(diagramMenu, _("&Diagram"));
	menuBar->Append(viewMenu, _("&View"));
	menuBar->Append(helpMenu, _("&Help"));
	SetMenuBar(menuBar);

	// Set status bar
	int iWidths[6] = {0, -1, 40, 150, 80, 80};
	CreateStatusBar(6);
	SetStatusBarPane(-1);
	SetStatusWidths(6, iWidths);

	// Set toolbar
	toolBar = new ctlMenuToolbar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER);
	toolBar->SetToolBitmapSize(wxSize(16, 16));
	toolBar->AddTool(MNU_NEW, _("New Model"), *file_new_png_bmp, _("Create new model"), wxITEM_NORMAL);
	toolBar->AddTool(MNU_NEWDIAGRAM, _("New Diagram"), *ddnewdiagram_png_bmp, _("Add new diagram"), wxITEM_NORMAL);
	toolBar->AddSeparator();
	toolBar->AddTool(MNU_LOADMODEL, _("Open Model"), *file_open_png_bmp, _("Open existing model"), wxITEM_NORMAL);
	toolBar->AddTool(MNU_SAVEMODEL, _("Save Model"), *file_save_png_bmp, _("Save current model"), wxITEM_NORMAL);
	toolBar->AddSeparator();
	toolBar->AddTool(MNU_ADDTABLE, _("Add Table"), *table_png_bmp, _("Add empty table to the current model"), wxITEM_NORMAL);
	toolBar->AddTool(MNU_DELETETABLE, _("Delete Table"), wxBitmap(*ddRemoveTable2_png_img), _("Delete selected table"), wxITEM_NORMAL);
	toolBar->AddTool(MNU_ADDCOLUMN, _("Add Column"), *table_png_bmp, _("Add new column to the selected table"), wxITEM_NORMAL);
	toolBar->AddSeparator();
	toolBar->AddTool(MNU_GENERATEMODEL, _("Generate Model"), *continue_png_bmp, _("Generate SQL for the current model"), wxITEM_NORMAL);
	toolBar->AddTool(MNU_GENERATEDIAGRAM, _("Generate Diagram"), *ddgendiagram_png_bmp, _("Generate SQL for the current diagram"), wxITEM_NORMAL);
	toolBar->AddSeparator();
	toolBar->AddTool(CTL_IMPSCHEMA, _("Import Tables from database..."), *conversion_png_ico, _("Import tables from database schema to database designer model"), wxITEM_NORMAL);
	toolBar->AddSeparator();
	toolBar->AddTool(MNU_HELP, _("Help"), *help_png_bmp, _("Display help"), wxITEM_NORMAL);
	toolBar->Realize();

	// Create notebook for diagrams
	diagrams = new ctlAuiNotebook(this, CTL_DDNOTEBOOK, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON | wxAUI_NB_CLOSE_ON_ALL_TABS);

	// Now, the scratchpad
	sqltext = new ctlSQLBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxSIMPLE_BORDER | wxTE_RICH2);

	//Now, the Objects Browser
	wxSizer *browserSizer = new wxBoxSizer(wxHORIZONTAL);
	browserPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);

	// Add the database designer
	design = new ddDatabaseDesign(diagrams, this);

	// Create database model browser
	modelBrowser = new ddModelBrowser(browserPanel, DD_BROWSER, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxSIMPLE_BORDER, design);
	design->registerBrowser(modelBrowser);

	// Set browser Sizers
	browserSizer->Add(modelBrowser, 1, wxEXPAND);
	browserPanel->SetSizer(browserSizer);
	browserSizer->SetSizeHints(browserPanel);

	// Add view to notebook
	diagrams->AddPage(design->createDiagram(diagrams, _("unnamed"), false)->getView(), _("unnamed"));


	// Add the database selection bar and schema selector
	wxSizer *connectionSizer = new wxBoxSizer(wxHORIZONTAL);
	connectionPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, -1));
	cbConnection = new wxBitmapComboBox(connectionPanel, CTL_DDCONNECTION, wxEmptyString, wxDefaultPosition, wxSize(-1, -1), wxArrayString(), wxCB_READONLY | wxCB_DROPDOWN);
	if(conn)
		cbConnection->Append(conn->GetName(), CreateBitmap(GetServerColour(conn)), (void *)conn);
	cbConnection->Append(_("<new connection>"), wxNullBitmap, (void *) NULL);

	connectionSizer->Add(cbConnection, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
	connectionSizer->AddSpacer(5);
	connectionPanel->SetSizer(connectionSizer);
	connectionSizer->SetSizeHints(connectionPanel);


	// Add the panes
	manager.AddPane(diagrams,
	                wxAuiPaneInfo().Center().
	                Name(wxT("sqlQuery")).Caption(_("Database Designer")).
	                CaptionVisible(true).CloseButton(false).MaximizeButton(true).
	                Dockable(true).Movable(true));
	manager.AddPane(browserPanel,
	                wxAuiPaneInfo().Left().
	                Name(wxT("ModelBrowser")).Caption(_("Model Browser")).
	                CaptionVisible(true).CloseButton(true).MinimizeButton(true).
	                MinSize(wxSize(140, 100)).BestSize(wxSize(200, 200)));
	manager.AddPane(sqltext,
	                wxAuiPaneInfo().Bottom().
	                Name(wxT("sqlText")).Caption(_("SQL query")).
	                CaptionVisible(true).CloseButton(true).MaximizeButton(true).MinimizeButton(true).
	                MinSize(wxSize(200, 100)).BestSize(wxSize(350, 150)));
	manager.AddPane(toolBar,
	                wxAuiPaneInfo().Top().
	                Name(wxT("toolBar")).Caption(_("Tool bar")).
	                ToolbarPane().
	                LeftDockable(false).RightDockable(false));
	manager.AddPane(connectionPanel, wxAuiPaneInfo().Name(wxT("databaseBar"))
	                .Caption(_("Connection bar")).ToolbarPane().Top().
	                LeftDockable(false).RightDockable(false));

	// Update the AUI manager
	manager.Update();

	//Update browser info
	modelBrowser->SetSize(browserPanel->GetSize());

	previousChanged = true;
	setModelChanged(false);
	SetStatusText(wxString(wxT("Ready")), 1);
}
Beispiel #3
0
wxString Token::GetImplFilename() const
{
    if (!m_TokenTree)
        return wxString(_T(""));
    return m_TokenTree->GetFilename(m_ImplFileIdx);
}
Beispiel #4
0
//------------------------------------------------------------------------------
void OutputTree::UpdateOutput(bool resetTree, bool removeReports, bool removePlots)
{
   #if DEBUG_OUTPUT_TREE
   MessageInterface::ShowMessage
      ("OutputTree::UpdateOutput() resetTree=%d, removeReports=%d, removePlots=%d\n",
       resetTree, removeReports, removePlots);
   #endif
   
   // Collapse all reports. Consider ephemeris file as a report
   if (removeReports)
   {
      Collapse(mReportItem);
      Collapse(mEphemFileItem);
      if (GmatGlobal::Instance()->IsEventLocationAvailable())
         Collapse(mEventsItem);
   }
   
   // Remove all plots
   if (removePlots)
   {
      Collapse(mOrbitViewItem);
      Collapse(mGroundTrackItem);
      Collapse(mXyPlotItem);
   }
   
   // Delete all reports. Consider ephemeris file as a report
   if (removeReports)
   {
      DeleteChildren(mReportItem);
      DeleteChildren(mEphemFileItem);
      if (GmatGlobal::Instance()->IsEventLocationAvailable())
         DeleteChildren(mEventsItem);
   }
   
   // Delete all plots
   if (removePlots)
   {
      DeleteChildren(mOrbitViewItem);
      DeleteChildren(mGroundTrackItem);
      DeleteChildren(mXyPlotItem);
   }
   
   if (resetTree)    // do not load subscribers
      return;
   
   // get list of report files, ephemeris files, opengl plots, and xy plots
   StringArray listOfSubs = theGuiInterpreter->GetListOfObjects(Gmat::SUBSCRIBER);
   
   // put each subscriber in the proper folder
   for (unsigned int i=0; i<listOfSubs.size(); i++)
   {
      Subscriber *sub =
         (Subscriber*)theGuiInterpreter->GetConfiguredObject(listOfSubs[i]);
      
      wxString objName = wxString(listOfSubs[i].c_str());
      wxString objTypeName = wxString(sub->GetTypeName().c_str());
      objTypeName = objTypeName.Trim();
      
      if (objTypeName == "ReportFile")
      {
         AppendItem(mReportItem, objName, GmatTree::OUTPUT_ICON_REPORT_FILE, -1,
                    new GmatTreeItemData(objName, GmatTree::OUTPUT_REPORT));
      }
      // Removed checking for write ephemeris flag sice ephemeris file can be
      // toggled on after it is intially toggled off (LOJ: 2013.03.20)
      else if (objTypeName == "EphemerisFile")
         //&& sub->GetBooleanParameter("WriteEphemeris"))
      {
         if (sub->GetStringParameter("FileFormat") == "CCSDS-OEM")
         {
            AppendItem(mEphemFileItem, objName, GmatTree::OUTPUT_ICON_CCSDS_OEM_FILE, -1,
                       new GmatTreeItemData(objName, GmatTree::OUTPUT_CCSDS_OEM_FILE));
         }
      }
      else if (objTypeName == "OrbitView" &&
               sub->GetBooleanParameter("ShowPlot"))
      {
         AppendItem(mOrbitViewItem, objName, GmatTree::OUTPUT_ICON_ORBIT_VIEW, -1,
                    new GmatTreeItemData(objName, GmatTree::OUTPUT_ORBIT_VIEW));
      }
      else if (objTypeName == "GroundTrackPlot" &&
               sub->GetBooleanParameter("ShowPlot"))
      {
         AppendItem(mGroundTrackItem, objName, GmatTree::OUTPUT_ICON_GROUND_TRACK_PLOT, -1,
                    new GmatTreeItemData(objName, GmatTree::OUTPUT_GROUND_TRACK_PLOT));
      }
      else if (objTypeName == "XYPlot" &&
               sub->GetBooleanParameter("ShowPlot"))
      {
         AppendItem(mXyPlotItem, objName, GmatTree::OUTPUT_ICON_XY_PLOT, -1,
                    new GmatTreeItemData(objName, GmatTree::OUTPUT_XY_PLOT));
      }
   }

   // get list of Event Locators
   if (GmatGlobal::Instance()->IsEventLocationAvailable())
   {
      StringArray listOfEls = theGuiInterpreter->GetListOfObjects(Gmat::EVENT_LOCATOR);
      for (UnsignedInt i = 0; i < listOfEls.size(); ++i)
      {
         EventLocator *el =
            (EventLocator*)theGuiInterpreter->GetConfiguredObject(listOfEls[i]);
         if (el != NULL)
         {
            wxString objName = wxString(listOfEls[i].c_str());
            AppendItem(mEventsItem, objName, GmatTree::OUTPUT_ICON_REPORT_FILE, -1,
                  new GmatTreeItemData(objName, GmatTree::OUTPUT_EVENT_REPORT));
         }
      }
   }

   Expand(mReportItem);
   Expand(mEphemFileItem);
   Expand(mOrbitViewItem);
   Expand(mGroundTrackItem);
   Expand(mXyPlotItem);
   if (GmatGlobal::Instance()->IsEventLocationAvailable())
      Expand(mEventsItem);
}
Beispiel #5
0
void wxTextEntry::Remove(long from, long to)
{
    DoSetSelection(from, to, SetSel_NoScroll);
    WriteText(wxString());
}
Beispiel #6
0
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxMenu, wxEvtHandler, "wx/menu.h")
wxCOLLECTION_TYPE_INFO( wxMenuItem *, wxMenuItemList ) ;

#if wxUSE_EXTENDED_RTTI    
template<> void wxCollectionToVariantArray( wxMenuItemList const &theList,
                                           wxAnyList &value)
{
    wxListCollectionToAnyList<wxMenuItemList::compatibility_iterator>( theList, value ) ;
}
#endif

wxBEGIN_PROPERTIES_TABLE(wxMenu)
wxEVENT_PROPERTY( Select, wxEVT_COMMAND_MENU_SELECTED, wxCommandEvent)

wxPROPERTY( Title, wxString, SetTitle, GetTitle, wxString(), \
           0 /*flags*/, wxT("Helpstring"), wxT("group") )

wxREADONLY_PROPERTY_FLAGS( MenuStyle, wxMenuStyle, long, GetStyle, \
                          wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), \
                          wxT("group")) // style

wxPROPERTY_COLLECTION( MenuItems, wxMenuItemList, wxMenuItem*, Append, \
                      GetMenuItems, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
wxEND_PROPERTIES_TABLE()

wxEMPTY_HANDLERS_TABLE(wxMenu)

wxDIRECT_CONSTRUCTOR_2( wxMenu, wxString, Title, long, MenuStyle  )

wxDEFINE_FLAGS( wxMenuBarStyle )
Beispiel #7
0
// Define a constructor
TCWin::TCWin( ChartCanvas *parent, int x, int y, void *pvIDX )
{

    //    As a display optimization....
    //    if current color scheme is other than DAY,
    //    Then create the dialog ..WITHOUT.. borders and title bar.
    //    This way, any window decorations set by external themes, etc
    //    will not detract from night-vision

    long wstyle = wxCLIP_CHILDREN | wxDEFAULT_DIALOG_STYLE /*| wxRESIZE_BORDER*/ ;
    if( ( global_color_scheme != GLOBAL_COLOR_SCHEME_DAY )
            && ( global_color_scheme != GLOBAL_COLOR_SCHEME_RGB ) ) wstyle |= ( wxNO_BORDER );

#ifdef __WXOSX__
     wstyle |= wxSTAY_ON_TOP;
#endif
   
    pParent = parent;
    m_x = x;
    m_y = y;
    
    m_created = false;
    RecalculateSize();
     
    wxDialog::Create( parent, wxID_ANY, wxString( _T ( "" ) ), m_position ,
                      m_tc_size, wstyle );

    m_created = true;
    wxFont *qFont = GetOCPNScaledFont(_("Dialog"));
    SetFont( *qFont );
    

    pIDX = (IDX_entry *) pvIDX;
    gpIDXn++;

//    Set up plot type
    if( strchr( "Tt", pIDX->IDX_type ) ) {
        m_plot_type = TIDE_PLOT;
        SetTitle( wxString( _( "Tide" ) ) );
        gpIDX = pIDX;       // remember pointer for routeplan

    } else {
        m_plot_type = CURRENT_PLOT;
        SetTitle( wxString( _( "Current" ) ) );
    }

    m_pTCRolloverWin = NULL;


    int sx, sy;
    GetClientSize( &sx, &sy );
    
//    Figure out this computer timezone minute offset
    wxDateTime this_now = wxDateTime::Now();
    wxDateTime this_gmt = this_now.ToGMT();

#if wxCHECK_VERSION(2, 6, 2)
    wxTimeSpan diff = this_now.Subtract( this_gmt );
#else
    wxTimeSpan diff = this_gmt.Subtract ( this_now );
#endif

    int diff_mins = diff.GetMinutes();

    int station_offset = ptcmgr->GetStationTimeOffset( pIDX );

    m_corr_mins = station_offset - diff_mins;
    if( this_now.IsDST() ) m_corr_mins += 60;

//    Establish the inital drawing day as today
    m_graphday = wxDateTime::Now();
    wxDateTime graphday_00 = wxDateTime::Today();
    time_t t_graphday_00 = graphday_00.GetTicks();

    //    Correct a Bug in wxWidgets time support
    if( !graphday_00.IsDST() && m_graphday.IsDST() ) t_graphday_00 -= 3600;
    if( graphday_00.IsDST() && !m_graphday.IsDST() ) t_graphday_00 += 3600;

    m_t_graphday_00_at_station = t_graphday_00 - ( m_corr_mins * 60 );

    btc_valid = false;

    wxString* TClist = NULL;
    m_tList = new wxListBox( this, -1, wxPoint( sx * 65 / 100, 11 ),
                             wxSize( ( sx * 32 / 100 ), ( sy * 20 / 100 ) ), 0, TClist,
                             wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL  );

    //  Measure the size of a generic button, with label
    wxButton *test_button = new wxButton( this, wxID_OK, _( "OK" ), wxPoint( -1, -1), wxDefaultSize );
    test_button->GetSize( &m_tsx, &m_tsy );
    delete test_button;
    
    //  In the interest of readability, if the width of the dialog is too narrow, 
    //  simply skip showing the "Hi/Lo" list control.
    
    if( (m_tsy * 15) > sx )
        m_tList->Hide();
    
    
    OK_button = new wxButton( this, wxID_OK, _( "OK" ), wxPoint( sx - 100, sy - (m_tsy + 10) ),
                              wxDefaultSize );

    PR_button = new wxButton( this, ID_TCWIN_PR, _( "Prev" ), wxPoint( 10, sy - (m_tsy + 10) ),
                              wxSize( -1, -1 ) );

    wxSize texc_size = wxSize( ( sx * 60 / 100 ), ( sy *29 / 100 ) );
    if( !m_tList->IsShown()){
        texc_size = wxSize( ( sx * 90 / 100 ), ( sy *29 / 100 ) );
    }
        
    m_ptextctrl = new wxTextCtrl( this, -1, _T(""), wxPoint( sx * 3 / 100, 6 ),
                                  texc_size ,
                                  wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
    int bsx, bsy, bpx, bpy;
    PR_button->GetSize( &bsx, &bsy );
    PR_button->GetPosition( &bpx, &bpy );

    NX_button = new wxButton( this, ID_TCWIN_NX, _( "Next" ), wxPoint( bpx + bsx + 5, sy - (m_tsy + 10) ),
                              wxSize( -1, -1 ) );

    m_TCWinPopupTimer.SetOwner( this, TCWININF_TIMER );

    wxScreenDC dc;
    int text_height;
    dc.GetTextExtent(_T("W"), NULL, &text_height);
    m_button_height = text_height + 20;


    // Build graphics tools

    wxFont *dlg_font = FontMgr::Get().GetFont( _("Dialog") );
    int dlg_font_size = dlg_font->GetPointSize();

    pSFont = FontMgr::Get().FindOrCreateFont( dlg_font_size-2, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL,
                                                    wxFONTWEIGHT_NORMAL, FALSE, wxString( _T ( "Arial" ) ) );
    pSMFont = FontMgr::Get().FindOrCreateFont( dlg_font_size-1, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL,
                                                       wxFONTWEIGHT_NORMAL, FALSE, wxString( _T ( "Arial" ) ) );
    pMFont = FontMgr::Get().FindOrCreateFont( dlg_font_size, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD,
                                                      FALSE, wxString( _T ( "Arial" ) ) );
    pLFont = FontMgr::Get().FindOrCreateFont( dlg_font_size+1, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD,
                                                      FALSE, wxString( _T ( "Arial" ) ) );

    pblack_1 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UINFD" ) ), 1,
                                                                          wxPENSTYLE_SOLID );
    pblack_2 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UINFD" ) ), 2,
                                                                          wxPENSTYLE_SOLID );
    pblack_3 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UWHIT" ) ), 1,
                                                                          wxPENSTYLE_SOLID );
    pred_2 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UINFR" ) ), 4,
                                                                        wxPENSTYLE_SOLID );
    pltgray = wxTheBrushList->FindOrCreateBrush( GetGlobalColor( _T ( "UIBCK" ) ),
                                                                               wxBRUSHSTYLE_SOLID );
    pltgray2 = wxTheBrushList->FindOrCreateBrush( GetGlobalColor( _T ( "DILG1" ) ),
                                                                                wxBRUSHSTYLE_SOLID );

    DimeControl( this );

    //  Fill in some static text control information

    //  Tidi station information
    m_ptextctrl->Clear();

    wxString locn( pIDX->IDX_station_name, wxConvUTF8 );
    wxString locna, locnb;
    if( locn.Contains( wxString( _T ( "," ) ) ) ) {
        locna = locn.BeforeFirst( ',' );
        locnb = locn.AfterFirst( ',' );
    } else {
        locna = locn;
        locnb.Empty();
    }

    // write the first line
    wxTextAttr style;
    style.SetFont( *pLFont );
    m_ptextctrl->SetDefaultStyle( style );

    m_ptextctrl->AppendText( locna );
    m_ptextctrl->AppendText(_T("\n"));

    style.SetFont( *pSMFont );
    m_ptextctrl->SetDefaultStyle( style );

    if( !locnb.IsEmpty() )
        m_ptextctrl->AppendText( locnb );
    m_ptextctrl->AppendText(_T("\n"));


    //Reference to the master station
    if(( 't' == pIDX->IDX_type ) || ( 'c' == pIDX->IDX_type )) {
        wxString mref( pIDX->IDX_reference_name, wxConvUTF8 );
        mref.Prepend(_T(" "));

        m_ptextctrl->AppendText( _( "Reference Station :" ) );
        m_ptextctrl->AppendText(_T("\n"));

        m_ptextctrl->AppendText( mref );
        m_ptextctrl->AppendText(_T("\n"));

    }
    else {
        m_ptextctrl->AppendText(_T("\n"));
    }

    //      Show the data source
    wxString dsource( pIDX->source_ident, wxConvUTF8 );
    dsource.Prepend(_T(" "));

    m_ptextctrl->AppendText( _( "Data Source :" ) );
    m_ptextctrl->AppendText(_T("\n"));

    m_ptextctrl->AppendText( dsource );

    m_ptextctrl->ShowPosition( 0 );
}
Beispiel #8
0
void NyqRedirector::AppendText()
{
    mText->AppendText(wxString(s.c_str(), wxConvISO8859_1));
    s.clear();
}
Beispiel #9
0
// show project properties
//
void CDlgItemProperties::renderInfos(PROJECT* project_in) {
    std::string projectname;
    //collecting infos
    project_in->get_name(projectname);
    //disk usage needs additional lookups
    CMainDocument* pDoc = wxGetApp().GetDocument();
    pDoc->CachedDiskUsageUpdate();
    
    // CachedDiskUsageUpdate() may have invalidated our project 
    // pointer, so get an updated pointer to this project
    PROJECT* project = pDoc->project(project_in->master_url);
    if (!project) return;     // TODO: display some sort of error alert?

    std::vector<PROJECT*> dp = pDoc->disk_usage.projects;
    double diskusage=0.0;    
    for (unsigned int i=0; i< dp.size(); i++) {
        PROJECT* tp = dp[i];        
        std::string tname;        
        tp->get_name(tname);
        wxString t1(wxString(tname.c_str(), wxConvUTF8));
        if(t1.IsSameAs(wxString(projectname.c_str(), wxConvUTF8)) || t1.IsSameAs(wxString(project->master_url, wxConvUTF8))) {
            diskusage = tp->disk_usage;
            break;
        }
    }
    //set dialog title
    wxString wxTitle = _("Properties of project ");
    wxTitle.append(wxString(projectname.c_str(),wxConvUTF8));
    SetTitle(wxTitle);
    //layout controls
    addSection(_("General"));
    addProperty(_("URL"), wxString(project->master_url, wxConvUTF8));
    addProperty(_("User name"), wxString(project->user_name.c_str(), wxConvUTF8));
    addProperty(_("Team name"), wxString(project->team_name.c_str(), wxConvUTF8));
    addProperty(_("Resource share"), wxString::Format(wxT("%0.0f"), project->resource_share));
    if (project->min_rpc_time > dtime()) {
        addProperty(_("Scheduler RPC deferred for"), FormatTime(project->min_rpc_time - dtime()));
    }
    if (project->download_backoff) {
        addProperty(_("File downloads deferred for"), FormatTime(project->download_backoff));
    }
    if (project->upload_backoff) {
        addProperty(_("File uploads deferred for"), FormatTime(project->upload_backoff));
    }
    addProperty(_("Disk usage"), FormatDiskSpace(diskusage));
    addProperty(_("Computer ID"), wxString::Format(wxT("%d"), project->hostid));
    if (project->non_cpu_intensive) {
        addProperty(_("Non CPU intensive"), _("yes"));
    }
    addProperty(_("Suspended via GUI"), project->suspended_via_gui ? _("yes") : _("no"));
    addProperty(_("Don't request more work"), project->dont_request_more_work ? _("yes") : _("no"));
    if (project->scheduler_rpc_in_progress) {
        addProperty(_("Scheduler call in progress"), _("yes"));
    }
    if (project->trickle_up_pending) {
        addProperty(_("Trickle-up pending"), _("yes"));
    }
    if (strlen(project->venue)) {
        addProperty(_("Host location"), wxString(project->venue, wxConvUTF8));
    } else {
        addProperty(_("Host location"), _("default"));
    }

    if (project->attached_via_acct_mgr) {
        addProperty(_("Added via account manager"), _("yes"));
    }
    if (project->detach_when_done) {
        addProperty(_("Remove when tasks done"), _("yes"));
    }
    if (project->ended) {
        addProperty(_("Ended"), _("yes"));
    }
    addProperty(_("Tasks completed"), wxString::Format(wxT("%d"), project->njobs_success));
    addProperty(_("Tasks failed"), wxString::Format(wxT("%d"), project->njobs_error));

    addSection(_("Credit"));
    addProperty(_("User"),
        wxString::Format(
            wxT("%0.2f total, %0.2f average"),
            project->user_total_credit,
            project->user_expavg_credit
        )
    );
    addProperty(_("Host"),
        wxString::Format(
            wxT("%0.2f total, %0.2f average"),
            project->host_total_credit,
            project->host_expavg_credit
        )
    );
    
    if (!project->non_cpu_intensive) {
        addSection(_("Scheduling"));
        addProperty(_("Scheduling priority"), wxString::Format(wxT("%0.2f"), project->sched_priority));
        show_rsc(_("CPU"), project->rsc_desc_cpu);
        if (pDoc->state.host_info.coprocs.have_nvidia()) {
            show_rsc(
                wxString(proc_type_name(PROC_TYPE_NVIDIA_GPU), wxConvUTF8),
                project->rsc_desc_nvidia
            );
        }
        if (pDoc->state.host_info.coprocs.have_ati()) {
            show_rsc(
                wxString(proc_type_name(PROC_TYPE_AMD_GPU), wxConvUTF8),
                project->rsc_desc_ati
            );
        }
        if (pDoc->state.host_info.coprocs.have_intel_gpu()) {
            show_rsc(
                wxString(proc_type_name(PROC_TYPE_INTEL_GPU), wxConvUTF8),
                project->rsc_desc_intel_gpu
            );
        }
        double dcf = project->duration_correction_factor;
        // if it's exactly 1, it's not being used
        //
        if (dcf != 1) {
            addProperty(
                _("Duration correction factor"),
                wxString::Format(wxT("%0.4f"), dcf)
            );
        }
    }
    if (project->last_rpc_time) {
        wxDateTime dt;
        dt.Set((time_t)project->last_rpc_time);
        addProperty(_("Last scheduler reply"), dt.Format());
    }
    m_gbSizer->Layout();
    m_scrolledWindow->FitInside();
}
Beispiel #10
0
void wxMenuBar::MacInstallMenuBar()
{
    if ( s_macInstalledMenuBar == this )
        return ;

    MenuBarHandle menubar = NULL ;

#if TARGET_API_MAC_OSX
    menubar = NewHandleClear( 6 /* sizeof( MenuBarHeader ) */ ) ;
#else
    menubar = NewHandleClear( 12 ) ;
    (*menubar)[3] = 0x0a ;
#endif

    ::SetMenuBar( menubar ) ;
    DisposeMenuBar( menubar ) ;
    MenuHandle appleMenu = NULL ;

    verify_noerr( CreateNewMenu( kwxMacAppleMenuId , 0 , &appleMenu ) ) ;
    verify_noerr( SetMenuTitleWithCFString( appleMenu , CFSTR( "\x14" ) ) );

    // Add About/Preferences separator only on OS X
    // KH/RN: Separator is always present on 10.3 but not on 10.2
    // However, the change from 10.2 to 10.3 suggests it is preferred
#if TARGET_API_MAC_OSX
    InsertMenuItemTextWithCFString( appleMenu,
                CFSTR(""), 0, kMenuItemAttrSeparator, 0);
#endif
    InsertMenuItemTextWithCFString( appleMenu,
                CFSTR("About..."), 0, 0, 0);
    MacInsertMenu( appleMenu , 0 ) ;

    // clean-up the help menu before adding new items
    static MenuHandle mh = NULL ;

    if ( mh != NULL )
    {
        MenuItemIndex firstUserHelpMenuItem ;
        if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
        {
            for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
                DeleteMenuItem( mh , i ) ;
        }
        else
        {
            mh = NULL ;
        }
    }

#if TARGET_CARBON
    if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
    {
        wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
        if ( item == NULL || !(item->IsEnabled()) )
            DisableMenuCommand( NULL , kHICommandPreferences ) ;
        else
            EnableMenuCommand( NULL , kHICommandPreferences ) ;
    }

    // Unlike preferences which may or may not exist, the Quit item should be always
    // enabled unless it is added by the application and then disabled, otherwise
    // a program would be required to add an item with wxID_EXIT in order to get the
    // Quit menu item to be enabled, which seems a bit burdensome.
    if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macExitMenuItemId)
    {
        wxMenuItem *item = FindItem( wxApp::s_macExitMenuItemId , NULL ) ;
        if ( item != NULL && !(item->IsEnabled()) )
            DisableMenuCommand( NULL , kHICommandQuit ) ;
        else
            EnableMenuCommand( NULL , kHICommandQuit ) ;
    }
#endif
    wxString strippedHelpMenuTitle = wxStripMenuCodes( wxApp::s_macHelpMenuTitleName ) ;
    wxString strippedTranslatedHelpMenuTitle = wxStripMenuCodes( wxString( _("&Help") ) ) ;

    wxString strippedWindowMenuTitle = wxStripMenuCodes( wxString(wxT("&Window")) /* wxApp::s_macWindowMenuTitleName */ ) ;
    wxString strippedTranslatedWindowMenuTitle = wxStripMenuCodes( wxString( _("&Window") ) ) ;

    wxMenuList::compatibility_iterator menuIter = m_menus.GetFirst();
    for (size_t i = 0; i < m_menus.GetCount(); i++, menuIter = menuIter->GetNext())
    {
        wxMenuItemList::compatibility_iterator node;
        wxMenuItem *item;
        wxMenu* menu = menuIter->GetData() , *subMenu = NULL ;
        wxString strippedMenuTitle = wxStripMenuCodes(m_titles[i]);

        if ( strippedMenuTitle == wxT("?") || strippedMenuTitle == strippedHelpMenuTitle || strippedMenuTitle == strippedTranslatedHelpMenuTitle )
        {
            for (node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext())
            {
                item = (wxMenuItem *)node->GetData();
                subMenu = item->GetSubMenu() ;
                if (subMenu)
                {
                    UMAAppendMenuItem(mh, wxStripMenuCodes(item->GetText()) , wxFont::GetDefaultEncoding() );
                    MenuItemIndex position = CountMenuItems(mh);
                    ::SetMenuItemHierarchicalMenu(mh, position, MAC_WXHMENU(subMenu->GetHMenu()));
                }
                else
                {
                    if ( item->GetId() != wxApp::s_macAboutMenuItemId )
                    {
                        if ( mh == NULL )
                        {
                            MenuItemIndex firstUserHelpMenuItem ;
                            if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) != noErr )
                            {
                                mh = NULL ;
                                break ;
                            }
                        }
                    }

                    if ( item->IsSeparator() )
                    {
                        if ( mh )
                            AppendMenuItemTextWithCFString( mh,
                                CFSTR(""), kMenuItemAttrSeparator, 0,NULL);
                    }
                    else
                    {
                        wxAcceleratorEntry*
                            entry = wxAcceleratorEntry::Create( item->GetText() ) ;

                        if ( item->GetId() == wxApp::s_macAboutMenuItemId )
                        {
                            // this will be taken care of below
                        }
                        else
                        {
                            if ( mh )
                            {
                                UMAAppendMenuItem(mh, wxStripMenuCodes(item->GetText()) , wxFont::GetDefaultEncoding(), entry);
                                MenuItemIndex position = CountMenuItems(mh);
                                SetMenuItemCommandID( mh , position, wxIdToMacCommand ( item->GetId() ) );
                                SetMenuItemRefCon( mh , position, (URefCon) item );
                                item->DoUpdateItemBitmap( mh, position );
                            }
                        }

                        delete entry ;
                    }
                }
            }
        }
        else if ( (strippedMenuTitle == wxT("Window") || strippedMenuTitle == strippedWindowMenuTitle || strippedMenuTitle == strippedTranslatedWindowMenuTitle )
                && GetAutoWindowMenu() )
        {
            if ( MacGetWindowMenuHMenu() == NULL )
            {
                CreateStandardWindowMenu( 0 , (MenuHandle*) &s_macWindowMenuHandle ) ;
            }

            MenuRef wm = (MenuRef)MacGetWindowMenuHMenu();
            if ( wm == NULL )
                break;

            // get the insertion point in the standard menu
            MenuItemIndex winListStart;
            GetIndMenuItemWithCommandID(wm,
                        kHICommandWindowListSeparator, 1, NULL, &winListStart);

            // add a separator so that the standard items and the custom items
            // aren't mixed together, but only if this is the first run
            OSStatus err = GetIndMenuItemWithCommandID(wm,
                        'WXWM', 1, NULL, NULL);

            if ( err == menuItemNotFoundErr )
            {
                InsertMenuItemTextWithCFString( wm,
                        CFSTR(""), winListStart-1, kMenuItemAttrSeparator, 'WXWM');
            }

            wxInsertMenuItemsInMenu(menu, wm, winListStart);
        }
        else
        {
            UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i], GetFont().GetEncoding()  ) ;
            menu->MacBeforeDisplay(false) ;

            ::InsertMenu(MAC_WXHMENU(_wxMenuAt(m_menus, i)->GetHMenu()), 0);
        }
    }

    // take care of the about menu item wherever it is
    {
        wxMenu* aboutMenu ;
        wxMenuItem *aboutMenuItem = FindItem(wxApp::s_macAboutMenuItemId , &aboutMenu) ;
        if ( aboutMenuItem )
        {
            wxAcceleratorEntry*
                entry = wxAcceleratorEntry::Create( aboutMenuItem->GetText() ) ;
            UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , wxStripMenuCodes ( aboutMenuItem->GetText() ) , wxFont::GetDefaultEncoding() );
            UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
            SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , kHICommandAbout ) ;
            SetMenuItemRefCon(GetMenuHandle( kwxMacAppleMenuId ) , 1 , (URefCon)aboutMenuItem ) ;
            UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
            
            delete entry;
        }
    }

    if ( GetAutoWindowMenu() )
    {
        if ( MacGetWindowMenuHMenu() == NULL )
            CreateStandardWindowMenu( 0 , (MenuHandle*) &s_macWindowMenuHandle ) ;

        InsertMenu( (MenuHandle) MacGetWindowMenuHMenu() , 0 ) ;
    }

    ::DrawMenuBar() ;
    s_macInstalledMenuBar = this;
}
Beispiel #11
0
// -------------------------------------------------------------------------------- //
void guPcListBox::CreateContextMenu( wxMenu * Menu ) const
{
    wxMenuItem * MenuItem;

    int SelCount = GetSelectedCount();
    int ContextMenuFlags = m_LibPanel->GetContextMenuFlags();

    MenuItem = new wxMenuItem( Menu, ID_PLAYCOUNT_PLAY,
                            wxString( _( "Play" ) ) + guAccelGetCommandKeyCodeString( ID_TRACKS_PLAY ),
                            _( "Play current selected tracks" ) );
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_player_tiny_light_play ) );
    Menu->Append( MenuItem );
    MenuItem->Enable( SelCount );

    MenuItem = new wxMenuItem( Menu, ID_PLAYCOUNT_ENQUEUE_AFTER_ALL,
                            wxString( _( "Enqueue" ) ) + guAccelGetCommandKeyCodeString( ID_TRACKS_ENQUEUE_AFTER_ALL ),
                            _( "Add current selected tracks to playlist" ) );
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
    Menu->Append( MenuItem );
    MenuItem->Enable( SelCount );

    wxMenu * EnqueueMenu = new wxMenu();

    MenuItem = new wxMenuItem( EnqueueMenu, ID_PLAYCOUNT_ENQUEUE_AFTER_TRACK,
                            wxString( _( "Current Track" ) ) +  guAccelGetCommandKeyCodeString( ID_TRACKS_ENQUEUE_AFTER_TRACK ),
                            _( "Add current selected tracks to playlist after the current track" ) );
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
    EnqueueMenu->Append( MenuItem );
    MenuItem->Enable( SelCount );

    MenuItem = new wxMenuItem( EnqueueMenu, ID_PLAYCOUNT_ENQUEUE_AFTER_ALBUM,
                            wxString( _( "Current Album" ) ) +  guAccelGetCommandKeyCodeString( ID_TRACKS_ENQUEUE_AFTER_ALBUM ),
                            _( "Add current selected tracks to playlist after the current album" ) );
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
    EnqueueMenu->Append( MenuItem );
    MenuItem->Enable( SelCount );

    MenuItem = new wxMenuItem( EnqueueMenu, ID_PLAYCOUNT_ENQUEUE_AFTER_ARTIST,
                            wxString( _( "Current Artist" ) ) +  guAccelGetCommandKeyCodeString( ID_TRACKS_ENQUEUE_AFTER_ARTIST ),
                            _( "Add current selected tracks to playlist after the current artist" ) );
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
    EnqueueMenu->Append( MenuItem );
    MenuItem->Enable( SelCount );

    Menu->Append( wxID_ANY, _( "Enqueue After" ), EnqueueMenu );

    if( SelCount )
    {
        if( ContextMenuFlags & guCONTEXTMENU_EDIT_TRACKS )
        {
            Menu->AppendSeparator();

            MenuItem = new wxMenuItem( Menu, ID_PLAYCOUNT_EDITTRACKS,
                                wxString( _( "Edit Songs" ) ) +  guAccelGetCommandKeyCodeString( ID_PLAYER_PLAYLIST_EDITTRACKS ),
                                _( "Edit the selected tracks" ) );
            MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_edit ) );
            Menu->Append( MenuItem );
        }

        Menu->AppendSeparator();

        MenuItem = new wxMenuItem( Menu, ID_PLAYCOUNT_SAVETOPLAYLIST,
                                wxString( _( "Save to Playlist" ) ) +  guAccelGetCommandKeyCodeString( ID_PLAYER_PLAYLIST_SAVE ),
                                _( "Save the selected tracks to playlist" ) );
        MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_doc_save ) );
        Menu->Append( MenuItem );

        if( ContextMenuFlags & guCONTEXTMENU_COPY_TO )
        {
            Menu->AppendSeparator();
            m_LibPanel->CreateCopyToMenu( Menu );
        }
    }

    m_LibPanel->CreateContextMenu( Menu );
}
Beispiel #12
0
void ParamEdit::OnDegButton(wxCommandEvent &event) {
	m_unit_input->WriteText(wxString(wxConvUTF8.cMB2WC(degree_char), *wxConvCurrent));
}
Beispiel #13
0
void ParamEdit::InitWidget(wxWindow *parent) {

	wxXmlResource::Get()->LoadDialog(this, parent, _T("param_edit"));
	
	m_unit_input = XRCCTRL(*this, "text_ctrl_unit", wxTextCtrl);
	assert(m_unit_input);

	wxStaticText *code_editor_stub = XRCCTRL(*this, "code_editor_stub", wxStaticText);
	wxSizer* stub_sizer = code_editor_stub->GetContainingSizer();
	size_t i = 0;
	while (stub_sizer->GetItem(i) && stub_sizer->GetItem(i)->GetWindow() != code_editor_stub)
		i++;
	assert(stub_sizer->GetItem(i));
	wxWindow *stub_parent = code_editor_stub->GetParent();

	m_formula_input = new CodeEditor(stub_parent);
	m_formula_input->SetSize(code_editor_stub->GetSize());

	stub_sizer->Detach(code_editor_stub);
	code_editor_stub->Destroy();
	stub_sizer->Insert(i, m_formula_input, 1, wxALL | wxEXPAND, 4 );
	stub_sizer->Layout();

	m_found_date_label = XRCCTRL(*this, "found_date_label", wxStaticText);

	m_prec_spin = XRCCTRL(*this, "spin_ctrl_prec", wxSpinCtrl);
	
	m_spin_ctrl_start_hours = XRCCTRL(*this, "spin_ctrl_start_hours", wxSpinCtrl);
	
	m_spin_ctrl_start_minutes = XRCCTRL(*this, "spin_ctrl_start_minutes", wxSpinCtrl);
	
	m_datepicker_ctrl_start_date = XRCCTRL(*this, "datepicker_ctrl_start_date", wxDatePickerCtrl);
	
	m_checkbox_start = XRCCTRL(*this, "checkbox_start", wxCheckBox);

	m_button_base_config = XRCCTRL(*this, "button_base_config", wxButton);

	m_button_formula_undo = XRCCTRL(*this, "formula_undo_button", wxButton);

	m_button_formula_redo = XRCCTRL(*this, "formula_redo_button", wxButton);

	m_button_formula_new_param = XRCCTRL(*this, "formula_new_param_button", wxButton);

	m_formula_type_choice = XRCCTRL(*this, "FORMULA_TYPE_CHOICE", wxChoice);

	m_param_name_input = XRCCTRL(*this, "parameter_name", wxTextCtrl);

	m_user_param_label = XRCCTRL(*this, "user_param_label", wxStaticText);
	
	m_datepicker_ctrl_start_date->Enable(false);
	m_datepicker_ctrl_start_date->SetValue(wxDateTime::Now());
	m_spin_ctrl_start_hours->Enable(false);
	m_spin_ctrl_start_minutes->Enable(false);
	m_spin_ctrl_start_hours->SetValue(0);
	m_spin_ctrl_start_minutes->SetValue(0);

	wxButton* degree_button = XRCCTRL(*this, "button_degree", wxButton);
	degree_button->SetLabel(wxString(wxConvUTF8.cMB2WC(degree_char), *wxConvCurrent));

	m_inc_search = NULL;

	m_error = false;

	m_params_list = NULL;

	SetIcon(szFrame::default_icon);
	Centre();
}
Beispiel #14
0
void ClangDriver::OnPrepareTUEnded(wxCommandEvent& e)
{
    // Our thread is done
    m_isBusy = false;

    // Sanity
    ClangThreadReply* reply = (ClangThreadReply*)e.GetClientData();
    if(!reply) {
        return;
    }

    // Make sure we delete the reply at the end...
    std::auto_ptr<ClangThreadReply> ap(reply);

    // Delete the fake file...
    DoDeleteTempFile(reply->filename);

    // Just a notification without real info?
    if(reply->context == CTX_None) {
        return;
    }

    if(reply->context == ::CTX_CachePCH || reply->context == ::CTX_ReparseTU) {
        return; // Nothing more to be done
    }

    if(reply->context == CTX_GotoDecl || reply->context == CTX_GotoImpl) {
        // Unlike other context's the 'filename' specified here
        // does not belong to an editor (it could, but it is not necessarily true)
        DoGotoDefinition(reply);
        return;
    }

    // Adjust the activeEditor to fit the filename
    IEditor* editor = clMainFrame::Get()->GetMainBook()->FindEditor(reply->filename);
    if(!editor) {
        CL_DEBUG(wxT("Could not find an editor for file %s"), reply->filename.c_str());
        return;
    }

    m_activeEditor = editor;

    // What should we do with the TU?
    switch(reply->context) {
    case CTX_CachePCH:
        // Nothing more to be done
        return;
    default:
        break;
    }

    if(!reply->results && !reply->errorMessage.IsEmpty()) {
        // Notify about this error
        clCommandEvent event(wxEVT_CLANG_CODE_COMPLETE_MESSAGE);
        event.SetString(reply->errorMessage);
        event.SetInt(1); // indicates that this is an error message
        EventNotifier::Get()->AddPendingEvent(event);
        return;
    }

    if(m_activeEditor->GetCurrentPosition() < m_position) {
        CL_DEBUG(wxT("Current position is lower than the starting position, ignoring completion"));
        clang_disposeCodeCompleteResults(reply->results);
        return;
    }

    wxString typedString;
    if(m_activeEditor->GetCurrentPosition() > m_position) {
        // User kept on typing while the completion thread was working
        typedString = m_activeEditor->GetTextRange(m_position, m_activeEditor->GetCurrentPosition());
        if(typedString.find_first_not_of(wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_")) !=
                wxString::npos) {
            // User typed some non valid identifier char, cancel code completion
            CL_DEBUG(
                wxT("User typed: %s since the completion thread started working until it ended, ignoring completion"),
                typedString.c_str());
            clang_disposeCodeCompleteResults(reply->results);
            return;
        }
    }

    // update the filter word
    reply->filterWord.Append(typedString);
    CL_DEBUG(wxT("clang completion: filter word is %s"), reply->filterWord.c_str());

    // For the Calltip, remove the opening brace from the filter string
    wxString filterWord = reply->filterWord;
    if(GetContext() == CTX_Calltip && filterWord.EndsWith(wxT("("))) filterWord.RemoveLast();

    wxString lowerCaseFilter = filterWord;
    lowerCaseFilter.MakeLower();

    unsigned numResults = reply->results->NumResults;
    clang_sortCodeCompletionResults(reply->results->Results, reply->results->NumResults);
    std::vector<TagEntryPtr> tags;
    for(unsigned i = 0; i < numResults; i++) {
        CXCompletionResult result = reply->results->Results[i];
        CXCompletionString str = result.CompletionString;
        CXCursorKind kind = result.CursorKind;

        if(kind == CXCursor_NotImplemented) continue;

        wxString entryName, entrySignature, entryPattern, entryReturnValue;
        DoParseCompletionString(str, 0, entryName, entrySignature, entryPattern, entryReturnValue);

        wxString lowerCaseName = entryName;
        lowerCaseName.MakeLower();

        if(!lowerCaseFilter.IsEmpty() && !lowerCaseName.StartsWith(lowerCaseFilter)) continue;

        if(clang_getCompletionAvailability(str) != CXAvailability_Available) continue;

        TagEntry* t = new TagEntry();
        TagEntryPtr tag(t);
        tag->SetIsClangTag(true);
        tag->SetName(entryName);
        tag->SetPattern(entryPattern);
        tag->SetSignature(entrySignature);

// Add support for clang comment parsing
#if HAS_LIBCLANG_BRIEFCOMMENTS
        CXString BriefComment = clang_getCompletionBriefComment(str);
        const char* comment = clang_getCString(BriefComment);
        if(comment && comment[0] != '\0') {
            tag->SetComment(wxString(comment, wxConvUTF8));
        }

        clang_disposeString(BriefComment);
#endif

        switch(kind) {
        case CXCursor_EnumConstantDecl:
            tag->SetKind(wxT("enumerator"));
            break;

        case CXCursor_EnumDecl:
            tag->SetKind(wxT("enum"));
            break;

        case CXCursor_CXXMethod:
        case CXCursor_Constructor:
        case CXCursor_Destructor:
        case CXCursor_FunctionDecl:
        case CXCursor_FunctionTemplate:
            tag->SetKind(wxT("prototype"));
            break;

        case CXCursor_MacroDefinition:
            tag->SetKind(wxT("macro"));
            break;

        case CXCursor_Namespace:
            tag->SetKind(wxT("namespace"));
            break;

        case CXCursor_ClassDecl:
        case CXCursor_ClassTemplate:
        case CXCursor_ClassTemplatePartialSpecialization:
            tag->SetKind(wxT("class"));
            break;

        case CXCursor_StructDecl:
            tag->SetKind(wxT("struct"));
            break;

        case CXCursor_TypeRef:
        case CXCursor_TypedefDecl:
            tag->SetKind(wxT("typedef"));
            tag->SetKind(wxT("typedef"));
            break;
        default:
            tag->SetKind(wxT("variable"));
            break;
        }

        tags.push_back(tag);
    }

    clang_disposeCodeCompleteResults(reply->results);

    CL_DEBUG(wxT("Building completion results... done "));
    if(GetContext() == CTX_Calltip) {
        std::vector<TagEntryPtr> tips;
        TagsManagerST::Get()->GetFunctionTipFromTags(tags, filterWord, tips);
        m_activeEditor->ShowCalltip(new clCallTip(tips));

    } else {
        wxCodeCompletionBoxManager::Get().ShowCompletionBox(
            m_activeEditor->GetCtrl(), tags, wxCodeCompletionBox::kNone, wxNOT_FOUND);
    }
}
void WXMSearchReplaceDialog::WXMSearchReplaceDialogKeyDown(wxKeyEvent& event)
{
	int key=event.GetKeyCode();

	//g_SearchReplaceDialog->SetTitle(wxString()<<key);

	switch(key)
	{
	case WXK_ESCAPE:
		g_SearchReplaceDialog->Show(false);
		return;
	case WXK_RETURN:
	case WXK_NUMPAD_ENTER:
		if(this->GetClassInfo()->GetClassName()!=wxString(wxT("wxButton")))
		{
			wxCommandEvent e;
			wxButton* default_btn = static_cast<wxButton*>(g_SearchReplaceDialog->GetDefaultItem());
			if(default_btn == g_SearchReplaceDialog->WxButtonReplace)
				return g_SearchReplaceDialog->WxButtonReplaceClick(e); // no skip

			return g_SearchReplaceDialog->WxButtonFindNextClick(e); // no skip
		}
		break;
	case WXK_DOWN:
		if((MadEdit*)this==g_SearchReplaceDialog->m_FindText)
		{
			int x,y,w,h;
			g_SearchReplaceDialog->m_FindText->GetPosition(&x, &y);
			g_SearchReplaceDialog->m_FindText->GetSize(&w, &h);
			g_SearchReplaceDialog->PopupMenu(&g_SearchReplaceDialog->WxPopupMenuRecentFindText, x, y+h);
			return;
		}
		else if((MadEdit*)this==g_SearchReplaceDialog->m_ReplaceText)
		{
			int x,y,w,h;
			g_SearchReplaceDialog->m_ReplaceText->GetPosition(&x, &y);
			g_SearchReplaceDialog->m_ReplaceText->GetSize(&w, &h);
			g_SearchReplaceDialog->PopupMenu(&g_SearchReplaceDialog->WxPopupMenuRecentReplaceText, x, y+h);
			return;
		}
		break;
	}

	extern wxAcceleratorEntry g_AccelFindNext, g_AccelFindPrev;
	int flags=wxACCEL_NORMAL;
	if(event.m_altDown) flags|=wxACCEL_ALT;
	if(event.m_shiftDown) flags|=wxACCEL_SHIFT;
	if(event.m_controlDown) flags|=wxACCEL_CTRL;

	if(g_AccelFindNext.GetKeyCode()==key && g_AccelFindNext.GetFlags()==flags)
	{
		wxCommandEvent e;
		g_SearchReplaceDialog->WxButtonFindNextClick(e);
		return; // no skip
	}

	if(g_AccelFindPrev.GetKeyCode()==key && g_AccelFindPrev.GetFlags()==flags)
	{
		wxCommandEvent e;
		g_SearchReplaceDialog->WxButtonFindPrevClick(e);
		return; // no skip
	}

	event.Skip();
}
Beispiel #16
0
// show task properties
//
void CDlgItemProperties::renderInfos(RESULT* result) {
    CMainDocument* pDoc = wxGetApp().GetDocument();
    wxDateTime dt;
    wxString wxTitle = _("Properties of task ");
    wxTitle.append(wxString(result->name, wxConvUTF8));
    SetTitle(wxTitle);

    APP_VERSION* avp = NULL;
    WORKUNIT* wup = NULL;
    RESULT* r = pDoc->state.lookup_result(result->project_url, result->name);
    if (r) {
        avp = r->avp;
        wup = r->wup;
    }
    
    addProperty(_("Application"), FormatApplicationName(result));
    addProperty(_("Name"), wxString(result->wu_name, wxConvUTF8));
    addProperty(_("State"), result_description(result, false));
    if (result->received_time) {
        dt.Set((time_t)result->received_time);
        addProperty(_("Received"), dt.Format());
    }
    dt.Set((time_t)result->report_deadline);
    addProperty(_("Report deadline"), dt.Format());
    if (strlen(result->resources)) {
        addProperty(_("Resources"), wxString(result->resources, wxConvUTF8));
    }
    if (wup) {
        addProperty(_("Estimated computation size"), wxString::Format(wxT("%.0f GFLOPs"), wup->rsc_fpops_est/1e9));
    }
    if (result->active_task) {
        addProperty(_("CPU time at last checkpoint"), FormatTime(result->checkpoint_cpu_time));
        addProperty(_("CPU time"), FormatTime(result->current_cpu_time));
        if (result->elapsed_time >= 0) {
            addProperty(_("Elapsed time"), FormatTime(result->elapsed_time));
        }
        addProperty(_("Estimated time remaining"), FormatTime(result->estimated_cpu_time_remaining));
        addProperty(_("Fraction done"), wxString::Format(wxT("%.3f %%"), result->fraction_done*100));
        addProperty(_("Virtual memory size"), FormatDiskSpace(result->swap_size));
        addProperty(_("Working set size"), FormatDiskSpace(result->working_set_size_smoothed));
        if (result->slot >= 0) {
            addProperty(_("Directory"), wxString::Format(wxT("slots/%d"), result->slot));
        }
        if (result->pid) {
            addProperty(_("Process ID"), wxString::Format(wxT("%d"), result->pid));
        }
        if (result->progress_rate) {
            // express rate in the largest time unit (hr/min/sec) for which rate < 100%
            //
            if (result->progress_rate*3600 < 1) {
                addProperty(_("Progress rate"), wxString::Format(wxT("%f %% %s"), 100*3600*result->progress_rate, _("per hour")));
            } else if (result->progress_rate*60 < 1) {
                addProperty(_("Progress rate"), wxString::Format(wxT("%f %% %s"), 100*60*result->progress_rate, _("per minute")));
            } else {
                addProperty(_("Progress rate"), wxString::Format(wxT("%f %% %s"), 100*result->progress_rate, _("per second")));
            }
        }
    } else if (result->state >= RESULT_COMPUTE_ERROR) {
        addProperty(_("CPU time"), FormatTime(result->final_cpu_time));
        addProperty(_("Elapsed time"), FormatTime(result->final_elapsed_time));
    }
    m_gbSizer->Layout();
    m_scrolledWindow->FitInside();
}
void WXMSearchReplaceDialog::ResetMessage()
{
	StaticTextStatus->SetLabel(wxString());

	wxm::GetFrameStatusBar().SetField(wxm::STBF_HELP, wxEmptyString);
}
Beispiel #18
0
void Trace::parseFiles(void)
{
	struct stat st = {0};

	// No exe processing required
	if (!doProcessExe)
	{
		pDosHeader			= NULL;
		origData			= NULL;
		pPeHeader			= NULL;
		pOptHeader			= NULL;
		pSectionHeader		= NULL;
		sectionEntropy		= NULL;
		sectionCharProb		= NULL;
		return;
	}

	stat(this->orig_exe_file, &st);

	dwFileSize = st.st_size;
	
	FILE *fin = fopen(this->orig_exe_file, "rb");

	if (fin == NULL)
	{
		throw wxString(wxT("Could not open executable file for reading"));
	}
	
	// Allocate and initialize to zero
	origData = (unsigned char *) malloc(st.st_size);

	if (origData == NULL)
	{
		throw wxString(wxT("Could not allocate data"));
	}
	
	memset(origData, 0, st.st_size);

	// Read the file data
	size_t readData = fread(origData, st.st_size, 1, fin);

	// Should return 1 for one block read
	if (readData != 1)
	{
		throw wxString(wxT("Could not read original file data"));
	}
	
	fclose(fin);
	
	if (!origData)
	{
		//wxLogDebug(wxT("Could not MapViewOfFile for original file")); 
		throw wxString(wxT("Could not MapViewOfFile for original file"));
	}

	// Get the DOS headers
	pDosHeader = (PIMAGE_DOS_HEADER) origData;
	
	// Check for a valid header
	if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE)
	{
		//wxLogDebug(wxT("Not a valid DOS header"));
		throw wxString(wxT("Not a valid DOS header"));
	}

	// Get the NT headers
	// 
	// WARNING FROM THE PAST:
	// This code is most likely going to be the cause of problems when porting to 64-bit.
	// The reason is because either the e_lfanew structure member doesn't get converted properly
	// in the GCC compiler or the msvc compiler doesn't convert the pointers properly. at any
	// rate they don't agree.
	// Danny, August 2011
	pPeHeader = (PIMAGE_NT_HEADERS) (origData + pDosHeader->e_lfanew);

	if(pPeHeader->Signature != IMAGE_NT_SIGNATURE)
	{
		//wxLogDebug(wxT("Not a valid NT header"));
		throw wxString(wxT("Not a valid NT header"));
	}

	pOptHeader = &(pPeHeader->OptionalHeader);

	// This is going to be a 64 bit conversion problem
	pSectionHeader = (PIMAGE_SECTION_HEADER) ( (DWORD) pOptHeader + (DWORD) (pPeHeader->FileHeader.SizeOfOptionalHeader));

	// Calculate entropy of all the sections
	// This is the standard Shannon entropy algorithm, and was adopted from Ero Carrera's
	// Pefile code
	
	sectionEntropy = (float *) malloc(sizeof(float) * pPeHeader->FileHeader.NumberOfSections);

	if (sectionEntropy == NULL)
	{
		//wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__));
		return;
	}

	sectionCharProb = (float **) malloc(sizeof(float*) * pPeHeader->FileHeader.NumberOfSections);
	
	if (sectionCharProb == NULL)
	{
		//wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__));
		return;
	}
	
	for(WORD i = 0 ; i < pPeHeader->FileHeader.NumberOfSections ; i++)
	{
		sectionEntropy[i] = 0.0;
		sectionCharProb[i] = (float *) malloc(sizeof(float) * 256);

		if (sectionCharProb[i] == NULL)
		{
			//wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__));
			return;
		}

		memset(sectionCharProb[i], 0, sizeof(float) * 256);
		
		//wxLogDebug(wxT("Processing section %s\n"), pSectionHeader[i].Name);
		
		// Get the character count from the section data
		if(pSectionHeader[i].SizeOfRawData > 0)
		{
			for (DWORD j = 0 ;
			     j < pSectionHeader[i].SizeOfRawData && (pSectionHeader[i].PointerToRawData + j) < dwFileSize ;
			     j++)
			{
				unsigned char byte = origData[pSectionHeader[i].PointerToRawData + j];
				sectionCharProb[i][byte] += 1.0;
			}

			// Calculate the shannon entropy
			for(DWORD j = 0 ; j < 256 ; j++)
			{
				sectionCharProb[i][j] = sectionCharProb[i][j] / pSectionHeader[i].SizeOfRawData;
				if( sectionCharProb[i][j] > 0.0)
					sectionEntropy[i] += -1 * sectionCharProb[i][j] * ( log(sectionCharProb[i][j]) / log((float)2.0) );
			}
			
		}

		//									wxLogDebug(wxT("Entropy is %2.2f\n"), sectionEntropy[i]);

	}
}
Beispiel #19
0
void TCWin::OnPaint( wxPaintEvent& event )
{
    int x, y;
    int i;
    char sbuf[100];
    int w;
    float tcmax, tcmin;

    GetClientSize( &x, &y );
//    qDebug() << "OnPaint" << x << y;

#if 0    
    //  establish some graphic element sizes/locations
    int x_graph = x * 1 / 10;
    int y_graph = y * 32 / 100;
    int x_graph_w = x * 8 / 10;
    int y_graph_h = (y * .7)  - (3 * m_button_height);
    m_graph_rect = wxRect(x_graph, y_graph, x_graph_w, y_graph_h);

    wxSize texc_size = wxSize( ( x * 60 / 100 ), ( y *29 / 100 ) );
    if( !m_tList->IsShown()){
        texc_size = wxSize( ( x * 90 / 100 ), ( y *29 / 100 ) );
    }
    
    m_ptextctrl->SetSize(texc_size);
#endif                                  
    
    wxPaintDC dc( this );

    wxString tlocn( pIDX->IDX_station_name, wxConvUTF8 );

//     if(1/*bForceRedraw*/)
    {


        int x_textbox = x * 5 / 100;
        int y_textbox = 6;

        int x_textbox_w = x * 51 / 100;
        int y_textbox_h = y * 25 / 100;

        // box the location text & tide-current table
        dc.SetPen( *pblack_3 );
        dc.SetBrush( *pltgray2 );
        dc.DrawRoundedRectangle( x_textbox, y_textbox, x_textbox_w, y_textbox_h, 4 );    //location text box

        if(m_tList->IsShown()) {
            wxRect tab_rect = m_tList->GetRect();
            dc.DrawRoundedRectangle( tab_rect.x - 4, y_textbox, tab_rect.width + 8, y_textbox_h, 4 ); //tide-current table box
        }

        //    Box the graph
        dc.SetPen( *pblack_1 );
        dc.SetBrush( *pltgray );
        dc.DrawRectangle( m_graph_rect.x, m_graph_rect.y, m_graph_rect.width, m_graph_rect.height );

        int hour_delta = 1;
        
        //  On some platforms, we cannot draw rotated text.
        //  So, reduce the complexity of horizontal axis time labels
#ifndef __WXMSW__
        hour_delta = 4;
#endif        
        
        
        //    Horizontal axis
        dc.SetFont( *pSFont );
        for( i = 0; i < 25; i++ ) {
            int xd = m_graph_rect.x + ( ( i ) * m_graph_rect.width / 25 );
            if( hour_delta != 1 ){
                if( i % hour_delta == 0 ) {
                    dc.SetPen( *pblack_2 );
                    dc.DrawLine( xd, m_graph_rect.y, xd, m_graph_rect.y + m_graph_rect.height + 5 );
                    char sbuf[5];
                    sprintf( sbuf, "%02d", i );
                    int x_shim = -20;
                    dc.DrawText( wxString( sbuf, wxConvUTF8 ), xd + x_shim + ( m_graph_rect.width / 25 ) / 2, m_graph_rect.y + m_graph_rect.height + 8 );
                }
                else{
                    dc.SetPen( *pblack_1 );
                    dc.DrawLine( xd, m_graph_rect.y, xd, m_graph_rect.y + m_graph_rect.height + 5 );
                }
            }
            else{
                dc.SetPen( *pblack_1 );
                dc.DrawLine( xd, m_graph_rect.y, xd, m_graph_rect.y + m_graph_rect.height + 5 );
                wxString sst;
                sst.Printf( _T("%02d"), i );
                dc.DrawRotatedText( sst, xd + ( m_graph_rect.width / 25 ) / 2, m_graph_rect.y + m_graph_rect.height + 8, 270. );
            }
        }

        //    Make a line for "right now"
        time_t t_now = wxDateTime::Now().GetTicks();       // now, in ticks

        float t_ratio = m_graph_rect.width * ( t_now - m_t_graphday_00_at_station ) / ( 25 * 3600 );

        //must eliminate line outside the graph (in that case put it outside the window)
        int xnow = ( t_ratio < 0 || t_ratio > m_graph_rect.width ) ? -1 : m_graph_rect.x + (int) t_ratio;
        dc.SetPen( *pred_2 );
        dc.DrawLine( xnow, m_graph_rect.y, xnow, m_graph_rect.y + m_graph_rect.height );
        dc.SetPen( *pblack_1 );

        //    Build the array of values, capturing max and min and HW/LW list

        if( !btc_valid ) {

            float dir;
            tcmax = -10;
            tcmin = 10;
            float val;
            m_tList->Clear();
            int list_index = 0;
            bool wt;

            wxBeginBusyCursor();

            // get tide flow sens ( flood or ebb ? )
            ptcmgr->GetTideFlowSens( m_t_graphday_00_at_station, BACKWARD_ONE_HOUR_STEP,
                                     pIDX->IDX_rec_num, tcv[0], val, wt );

            for( i = 0; i < 26; i++ ) {
                int tt = m_t_graphday_00_at_station + ( i * FORWARD_ONE_HOUR_STEP );
                ptcmgr->GetTideOrCurrent( tt, pIDX->IDX_rec_num, tcv[i], dir );
                if( tcv[i] > tcmax ) tcmax = tcv[i];

                if( tcv[i] < tcmin ) tcmin = tcv[i];
                if( TIDE_PLOT == m_plot_type ) {
                    if( !( ( tcv[i] > val ) == wt ) )                // if tide flow sens change
                    {
                        float tcvalue;                                  //look backward for HW or LW
                        time_t tctime;
                        ptcmgr->GetHightOrLowTide( tt, BACKWARD_TEN_MINUTES_STEP,
                                                   BACKWARD_ONE_MINUTES_STEP, tcv[i], wt, pIDX->IDX_rec_num, tcvalue,
                                                   tctime );
                        wxDateTime tcd;                                                 //write date
                        wxString s, s1;
                        tcd.Set( tctime + ( m_corr_mins * 60 ) );
                        s.Printf( tcd.Format( _T("%H:%M  ") ) );
                        s1.Printf( _T("%05.2f "), tcvalue );                           //write value
                        s.Append( s1 );
                        Station_Data *pmsd = pIDX->pref_sta_data;                       //write unit
                        if( pmsd ) s.Append( wxString( pmsd->units_abbrv, wxConvUTF8 ) );
                        s.Append( _T("   ") );
                        ( wt ) ? s.Append( _("HW") ) : s.Append( _("LW") );         //write HW or LT

                        m_tList->Insert( s, list_index );                       // update table list
                        list_index++;
                        wt = !wt;                                            //change tide flow sens
                    }
                    val = tcv[i];
                }
                if( CURRENT_PLOT == m_plot_type ) {
                    wxDateTime thx;                                                     //write date
                    wxString s, s1;
                    thx.Set( (time_t) ( tt + ( m_corr_mins * 60 ) ) );
                    s.Printf( thx.Format( _T("%H:%M  ") ) );
                    s1.Printf( _T("%05.2f "), fabs( tcv[i] ) );                        //write value
                    s.Append( s1 );
                    Station_Data *pmsd = pIDX->pref_sta_data;                           //write unit
                    if( pmsd ) s.Append( wxString( pmsd->units_abbrv, wxConvUTF8 ) );
                    s1.Printf( _T("  %03.0f"), dir );                              //write direction
                    s.Append( s1 );
                    m_tList->Insert( s, list_index );                           // update table list
                    list_index++;
                }

            }

            wxEndBusyCursor();

//    Set up the vertical parameters based on Tide or Current plot
            if( CURRENT_PLOT == m_plot_type ) {
                it = __max ( abs (( int ) tcmin - 1 ), abs ( ( int ) tcmax + 1 ) );
                ib = -it;

                im = 2 * it;
                m_plot_y_offset = m_graph_rect.height / 2;
                val_off = 0;
            } else {
                ib = (int) tcmin;
                if( tcmin < 0 ) ib -= 1;
                it = (int) tcmax + 1;

                im = it - ib; //abs ( ib ) + abs ( it );
                m_plot_y_offset = ( m_graph_rect.height * ( it - ib ) ) / im;
                val_off = ib;
            }

//    Build spline list of points

            m_sList.DeleteContents( true );
            m_sList.Clear();

            for( i = 0; i < 26; i++ ) {
                wxPoint *pp = new wxPoint;
                pp->x = m_graph_rect.x + ( ( i ) * m_graph_rect.width / 25 );
                pp->y = m_graph_rect.y + ( m_plot_y_offset )
                - (int) ( ( tcv[i] - val_off ) * m_graph_rect.height / im );

                m_sList.Append( pp );
            }

            btc_valid = true;
        }

        dc.SetTextForeground( GetGlobalColor( _T ( "DILG3" ) ) );

        //    Vertical Axis

        //      Maybe skip some lines and legends if the range is too high
        int height_stext;
         dc.GetTextExtent( _T("1"), NULL, &height_stext );

        int i_skip = 1;
        if( height_stext > m_graph_rect.height / im ) i_skip = 2;

        i = ib;
        while( i < it + 1 ) {
            int yd = m_graph_rect.y + ( m_plot_y_offset ) - ( ( i - val_off ) * m_graph_rect.height / im );

            if( ( m_plot_y_offset + m_graph_rect.y ) == yd ) dc.SetPen( *pblack_2 );
            else
                dc.SetPen( *pblack_1 );

            dc.DrawLine( m_graph_rect.x, yd, m_graph_rect.x + m_graph_rect.width, yd );
            snprintf( sbuf, 99, "%d", i );
            dc.DrawText( wxString( sbuf, wxConvUTF8 ), m_graph_rect.x - 20, yd - 5 );
            i += i_skip;

        }

        //    Draw the Value curve
#if wxCHECK_VERSION(2, 9, 0)
        wxPointList *list = (wxPointList *)&m_sList;
#else
        wxList *list = (wxList *) &m_sList;
#endif

        dc.SetPen( *pblack_2 );
#if wxUSE_SPLINES
        dc.DrawSpline( list );
#else
        dc.DrawLines ( list );
#endif
        //  More Info

///
        int station_offset = ptcmgr->GetStationTimeOffset( pIDX );
        int h = station_offset / 60;
        int m = station_offset - ( h * 60 );
        if( m_graphday.IsDST() ) h += 1;
        m_stz.Printf( _T("Z %+03d:%02d"), h, m );

//    Make the "nice" (for the US) station time-zone string, brutally by hand
        wxString mtz;
        switch( ptcmgr->GetStationTimeOffset( pIDX ) ) {
        case -240:
            mtz = _T( "AST" );
            break;
        case -300:
            mtz = _T( "EST" );
            break;
        case -360:
            mtz = _T( "CST" );
            break;
        }

        if( mtz.Len() ) {
            if( m_graphday.IsDST() ) mtz[1] = 'D';

            m_stz = mtz;
        }

        dc.SetFont( *pSFont );
        dc.GetTextExtent( m_stz, &w, &h );
        dc.DrawText( m_stz, x / 2 - w / 2, y - 2 * m_button_height );

        wxString sdate = m_graphday.Format( _T ( "%m/%d/%Y" ) );
        dc.SetFont( *pMFont );
        dc.GetTextExtent( sdate, &w, &h );
        dc.DrawText( sdate, x / 2 - w / 2, y - 1.5 * m_button_height );

        Station_Data *pmsd = pIDX->pref_sta_data;
        if( pmsd ) {
            dc.GetTextExtent( wxString( pmsd->units_conv, wxConvUTF8 ), &w, &h );
            dc.DrawRotatedText( wxString( pmsd->units_conv, wxConvUTF8 ), 5,
                                m_graph_rect.y + m_graph_rect.height / 2 + w / 2, 90. );
        }

        //      Show flood and ebb directions
        if(( strchr( "c", pIDX->IDX_type ) ) || ( strchr( "C", pIDX->IDX_type ) )) {
            dc.SetFont( *pSFont );

            wxString fdir;
            fdir.Printf( _T("%03d"), pIDX->IDX_flood_dir );
            dc.DrawText( fdir, m_graph_rect.x + m_graph_rect.width + 4, m_graph_rect.y + m_graph_rect.height * 1 / 4 );

            wxString edir;
            edir.Printf( _T("%03d"), pIDX->IDX_ebb_dir );
            dc.DrawText( edir, m_graph_rect.x + m_graph_rect.width + 4, m_graph_rect.y + m_graph_rect.height * 3 / 4 );

        }

//    Today or tomorrow
        wxString sday;
        wxDateTime this_now = wxDateTime::Now();

        int day = m_graphday.GetDayOfYear();
        if( m_graphday.GetYear() == this_now.GetYear() ) {
            if( day == this_now.GetDayOfYear() ) sday.Append( _( "Today" ) );
            else if( day == this_now.GetDayOfYear() + 1 ) sday.Append( _( "Tomorrow" ) );
            else
                sday.Append( m_graphday.GetWeekDayName( m_graphday.GetWeekDay() ) );
        } else if( m_graphday.GetYear() == this_now.GetYear() + 1
                   && day == this_now.Add( wxTimeSpan::Day() ).GetDayOfYear() ) sday.Append(
                           _( "Tomorrow" ) );

        dc.SetFont( *pSFont );
//                dc.GetTextExtent ( wxString ( sday, wxConvUTF8 ), &w, &h );       2.9.1
//                dc.DrawText ( wxString ( sday, wxConvUTF8 ), 55 - w/2, y * 88/100 );    2.9.1
        dc.GetTextExtent( sday, &w, &h );
        dc.DrawText( sday, 55 - w / 2, y - 2 * m_button_height );

    }
}
Beispiel #20
0
void Trace::writeGmlFile(char *gmlfile)
{
	FILE *fout = NULL;
	const trace_address_t *addr = NULL;
	const trace_edge_t *edge = NULL;
	uint32_t width = 0;
	size_t addrCharLen = 0;

	//wxLogDebug(wxT("Writing output to %s\n"), gmlfile);

	fout = fopen(gmlfile, "w");

	if (fout == NULL)
	{
		throw wxString(wxT("Could not open gml file for output"));

	}

	int numedges = edgeMap.size();
	int numverts = bblMap.size();

	// GML header info
	fprintf(fout, "Creator \"ogdf::GraphAttributes::writeGML\"\n");
	fprintf(fout, "directed 1\n");
	fprintf(fout, "graph [\n");

	for(bblMap_t::const_iterator it = bblMap.begin() ; it != bblMap.end() ; it++)
	{
		addr = &it->second;
		fprintf(fout, "node [\n");
		fprintf(fout, "id %u\n", addr->num);
		//fprintf(fout, "template \"oreas:std:rect simple\"\n");
		if (it->first == START_ADDR)
		{
			fprintf(fout, "label \"<label font=\\\"Arial,10,-1,5,50,0,0,0,0,0\\\" align=\\\"68\\\" textColor=\\\"FFFFFFFF\\\">%8.8x</label>\"\n", addr->addr);
			addrCharLen = 0;
		}
		else if (addr->isApi == true)
		{
			fprintf(fout, "label \"<label font=\\\"Arial,10,-1,5,50,0,0,0,0,0\\\" align=\\\"68\\\" textColor=\\\"00000000\\\">%s</label>\"\n", addr->info.api);
			addrCharLen = strlen(addr->info.api);
		}
		else
		{
			fprintf(fout, "label \"<label font=\\\"Arial,10,-1,5,50,0,0,0,0,0\\\" align=\\\"68\\\" textColor=\\\"00000000\\\">%8.8x</label>\"\n", addr->addr);
			addrCharLen = 0;
		}
		fprintf(fout, "graphics [\n");
		fprintf(fout, "x %u.00000000\n", addr->x);
		fprintf(fout, "y %u.00000000\n", addr->y);
		fprintf(fout, "w %u.00000000\n", (addrCharLen <= 8 ? 80 : 10 * (unsigned int) addrCharLen));
		fprintf(fout, "h 20.00000000\n");
		fprintf(fout, "fill \"#%6.6x\"\n", addrColor(addr->addr));
		fprintf(fout, "line \"#000000\"\n");
		fprintf(fout, "pattern \"1\"\n");
		fprintf(fout, "stipple 1\n");
		fprintf(fout, "lineWidth 1.000000000\n");
		fprintf(fout, "type \"rectangle\"\n");
		fprintf(fout, "width 1.0\n");
		fprintf(fout, "]\n"); // end graphics
		fprintf(fout, "]\n"); // end node
	}

	for(edgeMap_t::const_iterator it = edgeMap.begin() ; it != edgeMap.end() ; it++)
	{
		edge = &it->second;
		fprintf(fout, "edge [\n");
		fprintf(fout, "source %u\n", bblMap[edge->src].num); 
		fprintf(fout, "target %u\n", bblMap[edge->dst].num);
		fprintf(fout, "generalization 0\n");
		fprintf(fout, "graphics [\n");
		fprintf(fout, "type \"line\"\n");
		fprintf(fout, "arrow \"none\"\n");
		fprintf(fout, "stipple 1\n");

		if (edge->count >= 1 && edge->count <= 10)
			width = edge->count;
		else
			width = 12;

		fprintf(fout, "lineWidth %u.000000000\n", width);
		fprintf(fout, "Line [\n");
		fprintf(fout, "point [ x 41.00000000 y 31.00000000 ]\n");
		fprintf(fout, "point [ x 41.00000000 y 31.00000000 ]\n");
		
		if (edge->count > 10000)
			fprintf(fout, "fill \"#0000bb\"\n");
		else
			fprintf(fout, "fill \"#000000\"\n");

		fprintf(fout, "]\n"); // end line
		fprintf(fout, "]\n"); // end graphics
		fprintf(fout, "]\n"); // end edge
	}
     
	fprintf(fout, "]\n"); // end graph

	fprintf(fout, "rootcluster [\n");

	for(bblMap_t::const_iterator it = bblMap.begin() ; it != bblMap.end() ; it++)
	{
		addr = &it->second;
        fprintf(fout, "vertex \"%u\"\n", addr->num);
	}

	fprintf(fout, "]\n"); // end root cluster
	
	fclose(fout);
}
Beispiel #21
0
void TCWin::OnTCWinPopupTimerEvent( wxTimerEvent& event )
{

    int x, y;
    bool ShowRollover;

    GetClientSize( &x, &y );
    wxRegion cursorarea(m_graph_rect);
    if( cursorarea.Contains( curs_x, curs_y ) ) {
        ShowRollover = true;
        SetCursor( *pParent->pCursorCross );
        if( NULL == m_pTCRolloverWin ) {
            m_pTCRolloverWin = new RolloverWin( this );
            m_pTCRolloverWin->SetMousePropogation( 1 );
            m_pTCRolloverWin->Hide();
        }
        float t, d;
        wxString p, s;
        //set time on x cursor position
        t = ( 25 / ( (float) x * 8 / 10 ) ) * ( (float) curs_x - ( (float) x * 1 / 10 ) );
        int tt = m_t_graphday_00_at_station + (int) ( t * 3600 );
        wxDateTime thd;
        time_t ths = tt + ( m_corr_mins * 60 );
        thd.Set( ths );
        p.Printf( thd.Format( _T("%Hh %Mmn") ) );
        p.Append( _T("\n") );

        //set tide level or current speed at that time
        ptcmgr->GetTideOrCurrent( tt, pIDX->IDX_rec_num, t, d );
        s.Printf( _T("%3.2f "), ( t < 0 && CURRENT_PLOT == m_plot_type ) ? -t : t ); // always positive if current
        p.Append( s );

        //set unit
        Station_Data *pmsd = pIDX->pref_sta_data;
        if( pmsd ) p.Append( wxString( pmsd->units_abbrv, wxConvUTF8 ) );

        //set current direction
        if( CURRENT_PLOT == m_plot_type ) {
            s.Printf( wxString("%3.0f°", wxConvUTF8), d );
            p.Append( _T("\n") );
            p.Append( s );
        }

        //set rollover area size
        wxSize win_size;
        win_size.Set( x * 90 / 100, y * 80 / 100 );

        m_pTCRolloverWin->SetString( p );
        m_pTCRolloverWin->SetBestPosition( curs_x, curs_y, 1, 1, TC_ROLLOVER, win_size );
        m_pTCRolloverWin->SetBitmap( TC_ROLLOVER );
        m_pTCRolloverWin->Refresh();
        m_pTCRolloverWin->Show();
    } else {
        SetCursor( *pParent->pCursorArrow );
        ShowRollover = false;
    }

    if( m_pTCRolloverWin && m_pTCRolloverWin->IsShown() && !ShowRollover ) {
        m_pTCRolloverWin->Hide();
        m_pTCRolloverWin = NULL;
    }

}
Beispiel #22
0
wxString XmlUtil::ReadElementText(TiXmlHandle handle, const char* elementName, const wxString& defaultValue) {
  TiXmlElement* element = handle.Child(elementName, 0).ToElement();
  if (element) return wxString(element->GetText(), wxConvUTF8);
  return defaultValue;
}
Beispiel #23
0
//------------------------------------------------------------------------------
void OutputTree::OnCompareNumericColumns(wxCommandEvent &event)
{
   #ifdef DEBUG_COMPARE
   MessageInterface::ShowMessage("OutputTree::OnCompareNumericColumns() entered\n");
   #endif
   
   ReportFile *theReport =
      (ReportFile*) theGuiInterpreter->GetConfiguredObject(theSubscriberName.c_str());
   
   if (!theReport)
   {
      MessageInterface::ShowMessage
         ("OutputTree::OnCompareNumericColumns() The ReportFile: %s is NULL.\n",
          theSubscriberName.WX_TO_C_STRING);
      return;
   }
   
   std::string basefilename = theReport->GetFullPathFileName();
   StringArray colTitles = theReport->GetRefObjectNameArray(Gmat::PARAMETER);
   wxString filename1 =
      wxFileSelector("Choose a file to open", "", "", "report|eph|txt",
                     "Report files (*.report)|*.report|"
                     "Text files (*.txt)|*.txt|"
                     "Text ephemeris files (*.eph)|*.eph|"
                     "All files (*.*)|*.*");
   
   if (filename1.empty())
      return;
   
   Real tol = GmatFileUtil::COMPARE_TOLERANCE;
   wxString tolStr;
   tolStr.Printf("%e", tol);
   tolStr = wxGetTextFromUser("Enter absolute tolerance to be used in flagging: ",
                              "Tolerance", tolStr, this);
   
   if (!tolStr.ToDouble(&tol))
   {
      wxMessageBox("Entered Invalid Tolerance", "Error", wxOK, this);
      return;
   }
    
   StringArray output =
      GmatFileUtil::CompareNumericColumns(1, basefilename.c_str(), filename1.c_str(), "", "",
                                          tol);
   
   ViewTextFrame *compWindow = GmatAppData::Instance()->GetCompareWindow();
   if (compWindow == NULL)
   {
      compWindow = 
         new ViewTextFrame(GmatAppData::Instance()->GetMainFrame(),
                           _T("Compare Utility"), 50, 50, 800, 500, "Permanent");
      GmatAppData::Instance()->SetCompareWindow(compWindow);
      wxString msg;
      msg.Printf(_T("GMAT Build Date: %s %s\n\n"),  __DATE__, __TIME__);  
      compWindow->AppendText(msg);
   }
   
   compWindow->Show(true);
   
   for (unsigned int i=0; i<output.size(); i++)
   {
      compWindow->AppendText(wxString(output[i].c_str()));
      MessageInterface::ShowMessage(output[i].c_str());
   }
}
Beispiel #24
0
void Edit::OnAnnotationRemove(wxCommandEvent& WXUNUSED(event))
{
  AnnotationSetText(GetCurrentLine(), wxString());
}
Beispiel #25
0
wxString pgsDifferent::value() const
{
	return wxString() << m_left->value() << wxT(" <> ") << m_right->value();
}
Beispiel #26
0
int Cn3DNoWin::Run(void)
{
    TRACEMSG("Hello! Running build from " << __DATE__);
    int status = 1;
    
    try {
    
        // validate arguments
        const CArgs& args = GetArgs();
        if (!(args["f"].HasValue() || args["d"].HasValue()) || (args["f"].HasValue() && args["d"].HasValue()))
            ERRORTHROW("Command line: Must supply one (and only one) of -f or -d");
        EModel_type model = eModel_type_ncbi_all_atom;
        if (args["o"].HasValue()) {
            if (args["o"].AsString() == "alpha")
                model = eModel_type_ncbi_backbone;
            else if (args["o"].AsString() == "PDB")
                model = eModel_type_pdb_model;
        }
        string favorite(args["s"].HasValue() ? args["s"].AsString() : kEmptyStr);

        // setup dirs
        SetUpWorkingDirectories(GetArguments().GetProgramName().c_str());

        // read dictionary
        wxString dictFile = wxString(GetDataDir().c_str()) + "bstdt.val";
        LoadStandardDictionary(dictFile.c_str());

        // set up registry 
        LoadRegistry();

        // local structure set and renderer
        StructureSet *sset = NULL;
        OpenGLRenderer renderer(NULL);

        // load data from file
        if (args["f"].HasValue()) {
            // if -o is present, assume this is a Biostruc file
            if (args["o"].HasValue()) {
                CNcbi_mime_asn1 *mime = CreateMimeFromBiostruc(args["f"].AsString(), model);
                if (!mime || !LoadDataOnly(&sset, &renderer, NULL, mime, favorite))
                    ERRORTHROW("Failed to load Biostruc file " << args["f"].AsString());
            } else {
                if (!LoadDataOnly(&sset, &renderer, args["f"].AsString().c_str(), NULL, favorite, model))
                    ERRORTHROW("Failed to load file " << args["f"].AsString());
            }
        }

        // else network fetch
        else {
            CNcbi_mime_asn1 *mime = LoadStructureViaCache(args["d"].AsString(), model, 0);
            if (!mime || !LoadDataOnly(&sset, &renderer, NULL, mime, favorite))
                ERRORTHROW("Failed to load from network with id " << args["d"].AsString());
        }

        if (!sset)
            ERRORTHROW("Somehow ended up with NULL sset");
        auto_ptr < StructureSet > sset_ap(sset); // so we can be sure it's deleted
        
        // export PNG image
        if (!ExportPNG(NULL, &renderer, args["p"].AsString(), args["w"].AsInteger(), args["h"].AsInteger(), args["i"].HasValue()))
            ERRORTHROW("PNG export failed");
        
        TRACEMSG("Done!");
        status = 0;
    
    } catch (ncbi::CException& ce) {
        ERRORMSG("Caught CException: " << ce.GetMsg());
    } catch (std::exception& e) {
        ERRORMSG("Caught exception: " << e.what());
    } catch (...) {
        ERRORMSG("Caught unknown exception");
    }

    return status;
}
Beispiel #27
0
wxString wxHtmlParser::GetInnerSource(const wxHtmlTag& tag)
{
    return wxString(tag.GetBeginIter(), tag.GetEndIter1());
}
Beispiel #28
0
bool wxTextDataObject::SetData(size_t len, const void *buf)
{
    SetText( wxString((const wxChar*)buf, len/sizeof(wxChar)) );

    return true;
}
Beispiel #29
0
void VtxSceneTabs::AddRenderTab(wxWindow *panel){

    // A top-level sizer

    wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
    panel->SetSizer(topSizer);

    // A second box sizer to give more space around the controls

    wxBoxSizer *boxSizer = new wxBoxSizer(wxVERTICAL);
    topSizer->Add(boxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

    wxStaticBoxSizer* check_options = new wxStaticBoxSizer(wxHORIZONTAL,panel,wxT("Render Options"));
	m_hdr=new wxCheckBox(panel, ID_HDR, "HDR");
	m_hdr->SetToolTip("Enable High dynamic range");
	check_options->Add(m_hdr,0,wxALIGN_LEFT|wxALL,1);

	m_shadows=new wxCheckBox(panel, ID_SHADOWS, "Shadows");
	m_shadows->SetToolTip("Enable shadows");
	check_options->Add(m_shadows,0,wxALIGN_LEFT|wxALL,1);

	m_geometry=new wxCheckBox(panel, ID_GEOMETRY, "Geometry");
	m_geometry->SetToolTip("Enable render pass geometry (tesselation)");
	check_options->Add(m_geometry,0,wxALIGN_LEFT|wxALL,1);

    boxSizer->Add(check_options, 0, wxALIGN_LEFT|wxALL,0);
    check_options->SetMinSize(wxSize(TABS_WIDTH-TABS_BORDER,-1));

	wxStaticBoxSizer* hdr_controls = new wxStaticBoxSizer(wxHORIZONTAL,panel,wxT("High Dynamic Range"));

	HDRMinSlider=new SliderCtrl(panel,ID_HDRMIN_SLDR,"Min",LABEL2,VALUE2,SLIDER2);
	HDRMinSlider->setRange(0.0,1.0);
	HDRMinSlider->slider->SetToolTip("Increase range in dark areas");

	hdr_controls->Add(HDRMinSlider->getSizer(),0,wxALIGN_LEFT|wxALL,0);

	HDRMaxSlider=new SliderCtrl(panel,ID_HDRMAX_SLDR,"Max",LABEL2,VALUE2,SLIDER2);
	HDRMaxSlider->setRange(0.0,5.0);
	HDRMaxSlider->slider->SetToolTip("Decreases range in light areas");

	hdr_controls->Add(HDRMaxSlider->getSizer(),0,wxALIGN_LEFT|wxALL,0);
	boxSizer->Add(hdr_controls, 0, wxALIGN_LEFT|wxALL,0);

	wxStaticBoxSizer* shadow_controls = new wxStaticBoxSizer(wxVERTICAL,panel,wxT("Shadows"));

	wxBoxSizer *hline = new wxBoxSizer(wxHORIZONTAL);

	ShadowBlurSlider=new SliderCtrl(panel,ID_SHADOW_BLUR_SLDR,"Blur",LABEL2,VALUE2,SLIDER2);
	ShadowBlurSlider->setRange(0.25,8.0);
	ShadowBlurSlider->slider->SetToolTip("Soften Shadow Edges");

	hline->Add(ShadowBlurSlider->getSizer(),0,wxALIGN_LEFT|wxALL,0);

	ShadowResSlider=new SliderCtrl(panel,ID_SHADOW_RES_SLDR,"Views",LABEL2,VALUE2,SLIDER2);
	ShadowResSlider->setRange(1,10);
	ShadowResSlider->slider->SetToolTip("Number of Light source views");
	ShadowResSlider->format=wxString("%0.0f");

	hline->Add(ShadowResSlider->getSizer(),0,wxALIGN_LEFT|wxALL,0);

	shadow_controls->Add(hline,0,wxALIGN_LEFT|wxALL,0);


	hline = new wxBoxSizer(wxHORIZONTAL);

	ShadowFovSlider=new SliderCtrl(panel,ID_SHADOW_FOV_SLDR,"FOV",LABEL2,VALUE2,SLIDER2);
	ShadowFovSlider->setRange(0.5,1.5);
	ShadowFovSlider->slider->SetToolTip("Light source field of view");

	hline->Add(ShadowFovSlider->getSizer(),0,wxALIGN_LEFT|wxALL,0);

	ShadowDovSlider=new SliderCtrl(panel,ID_SHADOW_DOV_SLDR,"DOV",LABEL2,VALUE2,SLIDER2);
	ShadowDovSlider->setRange(0.5,1.5);
	ShadowDovSlider->slider->SetToolTip("Light source depth of view");

	hline->Add(ShadowDovSlider->getSizer(),0,wxALIGN_LEFT|wxALL,0);

	shadow_controls->Add(hline,0,wxALIGN_LEFT|wxALL,0);
	boxSizer->Add(shadow_controls, 0, wxALIGN_LEFT|wxALL,0);

}
SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : KIWAY_PLAYER( parent, id, title, pos, size, style, name )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	m_mainMenu = new wxMenuBar( 0 );
	m_fileMenu = new wxMenu();
	wxMenuItem* m_newPlot;
	m_newPlot = new wxMenuItem( m_fileMenu, wxID_NEW, wxString( _("New Plot") ) , wxEmptyString, wxITEM_NORMAL );
	m_fileMenu->Append( m_newPlot );
	
	m_fileMenu->AppendSeparator();
	
	wxMenuItem* m_openWorkbook;
	m_openWorkbook = new wxMenuItem( m_fileMenu, wxID_OPEN, wxString( _("Open Workbook") ) , wxEmptyString, wxITEM_NORMAL );
	m_fileMenu->Append( m_openWorkbook );
	
	wxMenuItem* m_saveWorkbook;
	m_saveWorkbook = new wxMenuItem( m_fileMenu, wxID_SAVE, wxString( _("Save Workbook") ) , wxEmptyString, wxITEM_NORMAL );
	m_fileMenu->Append( m_saveWorkbook );
	
	m_fileMenu->AppendSeparator();
	
	wxMenuItem* m_saveImage;
	m_saveImage = new wxMenuItem( m_fileMenu, wxID_ANY, wxString( _("Save as image") ) , wxEmptyString, wxITEM_NORMAL );
	m_fileMenu->Append( m_saveImage );
	
	wxMenuItem* m_saveCsv;
	m_saveCsv = new wxMenuItem( m_fileMenu, wxID_ANY, wxString( _("Save as .csv file") ) , wxEmptyString, wxITEM_NORMAL );
	m_fileMenu->Append( m_saveCsv );
	
	m_fileMenu->AppendSeparator();
	
	wxMenuItem* m_exitSim;
	m_exitSim = new wxMenuItem( m_fileMenu, wxID_CLOSE, wxString( _("Exit Simulation") ) , wxEmptyString, wxITEM_NORMAL );
	m_fileMenu->Append( m_exitSim );
	
	m_mainMenu->Append( m_fileMenu, _("File") ); 
	
	m_simulationMenu = new wxMenu();
	m_runSimulation = new wxMenuItem( m_simulationMenu, wxID_ANY, wxString( _("Run Simulation") ) , wxEmptyString, wxITEM_NORMAL );
	m_simulationMenu->Append( m_runSimulation );
	
	m_simulationMenu->AppendSeparator();
	
	m_addSignals = new wxMenuItem( m_simulationMenu, wxID_ANY, wxString( _("Add signals...") ) , wxEmptyString, wxITEM_NORMAL );
	m_simulationMenu->Append( m_addSignals );
	
	m_probeSignals = new wxMenuItem( m_simulationMenu, wxID_ANY, wxString( _("Probe from schematics") ) , wxEmptyString, wxITEM_NORMAL );
	m_simulationMenu->Append( m_probeSignals );
	
	m_tuneValue = new wxMenuItem( m_simulationMenu, wxID_ANY, wxString( _("Tune component value") ) , wxEmptyString, wxITEM_NORMAL );
	m_simulationMenu->Append( m_tuneValue );
	
	m_simulationMenu->AppendSeparator();
	
	m_settings = new wxMenuItem( m_simulationMenu, wxID_ANY, wxString( _("Settings...") ) , wxEmptyString, wxITEM_NORMAL );
	m_simulationMenu->Append( m_settings );
	
	m_mainMenu->Append( m_simulationMenu, _("Simulation") ); 
	
	m_viewMenu = new wxMenu();
	wxMenuItem* m_zoomIn;
	m_zoomIn = new wxMenuItem( m_viewMenu, wxID_ZOOM_IN, wxString( _("Zoom In") ) , wxEmptyString, wxITEM_NORMAL );
	m_viewMenu->Append( m_zoomIn );
	
	wxMenuItem* m_zoomOut;
	m_zoomOut = new wxMenuItem( m_viewMenu, wxID_ZOOM_OUT, wxString( _("Zoom Out") ) , wxEmptyString, wxITEM_NORMAL );
	m_viewMenu->Append( m_zoomOut );
	
	wxMenuItem* m_zoomFit;
	m_zoomFit = new wxMenuItem( m_viewMenu, wxID_ZOOM_FIT, wxString( _("Fit on Screen") ) , wxEmptyString, wxITEM_NORMAL );
	m_viewMenu->Append( m_zoomFit );
	
	m_viewMenu->AppendSeparator();
	
	wxMenuItem* m_showGrid;
	m_showGrid = new wxMenuItem( m_viewMenu, wxID_ANY, wxString( _("Show &grid") ) , wxEmptyString, wxITEM_CHECK );
	m_viewMenu->Append( m_showGrid );
	
	wxMenuItem* m_showLegend;
	m_showLegend = new wxMenuItem( m_viewMenu, wxID_ANY, wxString( _("Show &legend") ) , wxEmptyString, wxITEM_CHECK );
	m_viewMenu->Append( m_showLegend );
	
	m_mainMenu->Append( m_viewMenu, _("View") ); 
	
	this->SetMenuBar( m_mainMenu );
	
	m_sizer1 = new wxBoxSizer( wxVERTICAL );
	
	m_toolBar = new wxToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_FLAT|wxTB_HORIZONTAL|wxTB_TEXT ); 
	m_toolBar->Realize(); 
	
	m_sizer1->Add( m_toolBar, 0, wxEXPAND, 5 );
	
	m_splitterPlot = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D );
	m_splitterPlot->SetSashGravity( 0.8 );
	m_splitterPlot->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterPlotOnIdle ), NULL, this );
	
	m_panel2 = new wxPanel( m_splitterPlot, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	m_sizer11 = new wxBoxSizer( wxVERTICAL );
	
	m_splitterConsole = new wxSplitterWindow( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D );
	m_splitterConsole->SetSashGravity( 0.8 );
	m_splitterConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterConsoleOnIdle ), NULL, this );
	
	m_plotPanel = new wxPanel( m_splitterConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	m_sizer5 = new wxBoxSizer( wxHORIZONTAL );
	
	m_plotNotebook = new wxAuiNotebook( m_plotPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_MIDDLE_CLICK_CLOSE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TAB_SPLIT|wxAUI_NB_TOP );
	m_welcomePanel = new wxPanel( m_plotNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	m_sizer8 = new wxBoxSizer( wxVERTICAL );
	
	
	m_sizer8->Add( 0, 0, 1, wxEXPAND, 5 );
	
	wxBoxSizer* bSizer81;
	bSizer81 = new wxBoxSizer( wxHORIZONTAL );
	
	
	bSizer81->Add( 0, 0, 1, wxEXPAND, 5 );
	
	m_staticText2 = new wxStaticText( m_welcomePanel, wxID_ANY, _("Start the simulation by clicking the Run Simulation button"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText2->Wrap( -1 );
	m_staticText2->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
	m_staticText2->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
	
	bSizer81->Add( m_staticText2, 0, wxALIGN_RIGHT|wxALL|wxEXPAND, 5 );
	
	
	bSizer81->Add( 0, 0, 1, wxEXPAND, 5 );
	
	
	m_sizer8->Add( bSizer81, 0, wxEXPAND, 5 );
	
	
	m_sizer8->Add( 0, 0, 1, wxEXPAND, 5 );
	
	
	m_welcomePanel->SetSizer( m_sizer8 );
	m_welcomePanel->Layout();
	m_sizer8->Fit( m_welcomePanel );
	m_plotNotebook->AddPage( m_welcomePanel, _("a page"), false, wxNullBitmap );
	
	m_sizer5->Add( m_plotNotebook, 1, wxEXPAND | wxALL, 5 );
	
	
	m_plotPanel->SetSizer( m_sizer5 );
	m_plotPanel->Layout();
	m_sizer5->Fit( m_plotPanel );
	m_panel5 = new wxPanel( m_splitterConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	m_sizer13 = new wxBoxSizer( wxVERTICAL );
	
	m_simConsole = new wxTextCtrl( m_panel5, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_DONTWRAP|wxTE_MULTILINE|wxTE_READONLY );
	m_simConsole->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
	
	m_sizer13->Add( m_simConsole, 1, wxALL|wxEXPAND, 5 );
	
	
	m_panel5->SetSizer( m_sizer13 );
	m_panel5->Layout();
	m_sizer13->Fit( m_panel5 );
	m_splitterConsole->SplitHorizontally( m_plotPanel, m_panel5, 500 );
	m_sizer11->Add( m_splitterConsole, 1, wxEXPAND, 5 );
	
	
	m_panel2->SetSizer( m_sizer11 );
	m_panel2->Layout();
	m_sizer11->Fit( m_panel2 );
	m_sidePanel = new wxPanel( m_splitterPlot, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	m_sideSizer = new wxBoxSizer( wxVERTICAL );
	
	wxStaticBoxSizer* sbSizer1;
	sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_sidePanel, wxID_ANY, _("Signals") ), wxVERTICAL );
	
	m_signals = new wxListBox( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_SORT ); 
	sbSizer1->Add( m_signals, 1, wxALL|wxEXPAND, 5 );
	
	
	m_sideSizer->Add( sbSizer1, 1, wxEXPAND, 5 );
	
	wxStaticBoxSizer* sbSizer3;
	sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_sidePanel, wxID_ANY, _("Cursors") ), wxVERTICAL );
	
	m_cursors = new wxListCtrl( sbSizer3->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL );
	sbSizer3->Add( m_cursors, 1, wxALL|wxEXPAND, 5 );
	
	
	m_sideSizer->Add( sbSizer3, 1, wxEXPAND, 5 );
	
	sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_sidePanel, wxID_ANY, _("Tune") ), wxVERTICAL );
	
	m_tuneSizer = new wxBoxSizer( wxHORIZONTAL );
	
	
	sbSizer4->Add( m_tuneSizer, 1, wxEXPAND, 5 );
	
	
	m_sideSizer->Add( sbSizer4, 1, wxEXPAND, 5 );
	
	
	m_sidePanel->SetSizer( m_sideSizer );
	m_sidePanel->Layout();
	m_sideSizer->Fit( m_sidePanel );
	m_splitterPlot->SplitVertically( m_panel2, m_sidePanel, 700 );
	m_sizer1->Add( m_splitterPlot, 1, wxEXPAND, 5 );
	
	
	this->SetSizer( m_sizer1 );
	this->Layout();
	
	this->Centre( wxBOTH );
	
	// Connect Events
	this->Connect( m_newPlot->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuNewPlot ) );
	this->Connect( m_openWorkbook->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuOpenWorkbook ) );
	this->Connect( m_saveWorkbook->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuSaveWorkbook ) );
	this->Connect( m_saveImage->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuSaveImage ) );
	this->Connect( m_saveCsv->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuSaveCsv ) );
	this->Connect( m_exitSim->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuExit ) );
	this->Connect( m_zoomIn->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomIn ) );
	this->Connect( m_zoomOut->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomOut ) );
	this->Connect( m_zoomFit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomFit ) );
	this->Connect( m_showGrid->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuShowGrid ) );
	this->Connect( m_showGrid->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowGridUpdate ) );
	this->Connect( m_showLegend->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuShowLegend ) );
	this->Connect( m_showLegend->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowLegendUpdate ) );
	m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotChanged ), NULL, this );
	m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotClose ), NULL, this );
	m_signals->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::onSignalDblClick ), NULL, this );
	m_signals->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( SIM_PLOT_FRAME_BASE::onSignalRClick ), NULL, this );
}