Esempio n. 1
0
DelayPlugin::DelayPlugin(PlugStartInfo &startinfo, PlugInitInfo *initinfo)
  : Plugin(startinfo, initinfo), Bypass(false)
{
  BufStart[0] = 0x0;
  BufStart[1] = 0x0;
  Init();

  wxImage *tr_bg = 
    new wxImage(GetDataDir() + wxString(IMG_DL_BG), wxBITMAP_TYPE_PNG);
  TpBmp = new wxBitmap(*tr_bg);

  liquid_on = new wxImage(GetDataDir() + wxString(IMG_LIQUID_ON), wxBITMAP_TYPE_PNG);
  liquid_off = new wxImage(GetDataDir() + wxString(IMG_LIQUID_OFF), wxBITMAP_TYPE_PNG);
  Liquid = new StaticBitmap(this, -1, wxBitmap(*liquid_on), wxPoint(22, 25));

  bypass_on = new wxImage(GetDataDir() + wxString(IMG_BYPASS_ON), wxBITMAP_TYPE_PNG);
  bypass_off = new wxImage(GetDataDir() + wxString(IMG_BYPASS_OFF), wxBITMAP_TYPE_PNG);
  BypassBtn = new DownButton(this, Delay_Bypass, wxPoint(21, 58), 
			     wxSize(bypass_on->GetWidth(), bypass_on->GetHeight()), bypass_off, bypass_on);

  bmp = new wxBitmap(GetDataDir() + wxString(IMG_DL_BMP),
		     wxBITMAP_TYPE_BMP); 
  img_bg = new wxImage(GetDataDir() + wxString(IMG_DL_FADER_BG),
		       wxBITMAP_TYPE_PNG);
  img_fg = new wxImage(GetDataDir() + wxString(IMG_DL_FADER_FG), 
		       wxBITMAP_TYPE_PNG );
  TimeFader = new FaderCtrl(this, Delay_Time, img_bg, img_fg, 0, MAX_TIME, 
			    &DelayTime, true, wxPoint(73, 11), 
			    wxSize(img_bg->GetWidth(), img_bg->GetHeight()),
			    this, GetPosition() + wxPoint(58, 25));
  FeedbackFader = new FaderCtrl(this, Delay_Feedback, img_bg, img_fg, 0, 100, 
				&Feedback, true, wxPoint(110, 11),
				wxSize(img_bg->GetWidth(), 
				       img_bg->GetHeight()),
				this, GetPosition() + wxPoint(95, 35));
  DryWetFader = new FaderCtrl(this, Delay_DryWet, img_bg, img_fg, 0, 100, 
			      &WetLevel, true, wxPoint(149, 11), 
			      wxSize(img_bg->GetWidth(), img_bg->GetHeight()),
			      this, GetPosition() + wxPoint(135, 35));
  SetBackgroundColour(wxColour(237, 237, 237));

  // Midi automation defaults
  MidiTime[0] = M_CONTROL;
  MidiTime[1] = 0xA;
  MidiFeedback[0] = M_CONTROL;
  MidiFeedback[1] = 0xB;
  MidiDryWet[0] = M_CONTROL;
  MidiDryWet[1] = 0xC;
  MidiBypass[0] = -1;
  MidiBypass[1] = -1;
  
  Connect(Delay_Bypass, wxEVT_RIGHT_DOWN,
	  (wxObjectEventFunction)(wxEventFunction) 
	  (wxMouseEventFunction)&DelayPlugin::OnBypassController);    
  Connect(Delay_Time, wxEVT_RIGHT_DOWN,
	  (wxObjectEventFunction)(wxEventFunction) 
	  (wxMouseEventFunction)&DelayPlugin::OnTimeController); 
  Connect(Delay_Feedback, wxEVT_RIGHT_DOWN,
	  (wxObjectEventFunction)(wxEventFunction) 
	  (wxMouseEventFunction)&DelayPlugin::OnFeedbackController);    
  Connect(Delay_DryWet, wxEVT_RIGHT_DOWN,
	  (wxObjectEventFunction)(wxEventFunction) 
	  (wxMouseEventFunction)&DelayPlugin::OnDryWetController);    
}
CompilationErrorDialog::CompilationErrorDialog(wxWindow* parent, gd::String report)
{
	//(*Initialize(CompilationErrorDialog)
	wxFlexGridSizer* FlexGridSizer4;
	wxFlexGridSizer* FlexGridSizer3;
	wxFlexGridSizer* FlexGridSizer2;
	wxFlexGridSizer* FlexGridSizer6;
	wxFlexGridSizer* FlexGridSizer1;

	Create(parent, wxID_ANY, _("Error(s) during compilation"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER, _T("wxID_ANY"));
	FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
	FlexGridSizer1->AddGrowableCol(0);
	FlexGridSizer1->AddGrowableRow(2);
	Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
	Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
	FlexGridSizer6 = new wxFlexGridSizer(0, 2, 0, 0);
	StaticBitmap3 = new wxStaticBitmap(Panel1, ID_STATICBITMAP3, wxBitmap(wxImage(_T("res/error24.png"))), wxDefaultPosition, wxDefaultSize, wxNO_BORDER, _T("ID_STATICBITMAP3"));
	FlexGridSizer6->Add(StaticBitmap3, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
	StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, _("An error occurred during the compilation, and the game could not be created.\nSee the report below to see which step caused an error."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT1"));
	FlexGridSizer6->Add(StaticText1, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	Panel1->SetSizer(FlexGridSizer6);
	FlexGridSizer6->Fit(Panel1);
	FlexGridSizer6->SetSizeHints(Panel1);
	FlexGridSizer1->Add(Panel1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	StaticLine2 = new wxStaticLine(this, ID_STATICLINE2, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE2"));
	FlexGridSizer1->Add(StaticLine2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	FlexGridSizer2 = new wxFlexGridSizer(0, 3, 0, 0);
	FlexGridSizer2->AddGrowableCol(0);
	FlexGridSizer2->AddGrowableRow(0);
	ReportEdit = new wxTextCtrl(this, ID_TEXTCTRL1, _("No information concerning the error."), wxDefaultPosition, wxSize(253,97), wxTE_MULTILINE|wxTE_READONLY, wxDefaultValidator, _T("ID_TEXTCTRL1"));
	FlexGridSizer2->Add(ReportEdit, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticLine1 = new wxStaticLine(this, ID_STATICLINE1, wxDefaultPosition, wxSize(-1,90), wxLI_VERTICAL, _T("ID_STATICLINE1"));
	FlexGridSizer2->Add(StaticLine1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	FlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0);
	StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("How solve the problem \?"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
	wxFont StaticText2Font(wxDEFAULT,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,wxEmptyString,wxFONTENCODING_DEFAULT);
	StaticText2->SetFont(StaticText2Font);
	FlexGridSizer3->Add(StaticText2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("A problem when copying a known file:\n  -Check that your file (image, sound ...) exists.\n  -Check you have read/write permission. \n\nA problem when copying a file unknown:\n  -Check that the file in question exists. \n    If not, try reinstalling GDevelop\n  -Check you have read/write permission.\n\nA problem when creating a file:\n  -Make sure you have read/write\n   permission."), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3"));
	FlexGridSizer3->Add(StaticText3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer2->Add(FlexGridSizer3, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	FlexGridSizer1->Add(FlexGridSizer2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	StaticLine3 = new wxStaticLine(this, ID_STATICLINE3, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE3"));
	FlexGridSizer1->Add(StaticLine3, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	FlexGridSizer4 = new wxFlexGridSizer(0, 3, 0, 0);
	FlexGridSizer4->AddGrowableCol(0);
	StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("If you can not solve the problem, do not hesitate to contact us"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4"));
	wxFont StaticText4Font(wxDEFAULT,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_ITALIC,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT);
	StaticText4->SetFont(StaticText4Font);
	FlexGridSizer4->Add(StaticText4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FermerBt = new wxButton(this, ID_BUTTON2, _("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
	FlexGridSizer4->Add(FermerBt, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	AideBt = new wxButton(this, ID_BUTTON1, _("Help"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
	FlexGridSizer4->Add(AideBt, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer1->Add(FlexGridSizer4, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	SetSizer(FlexGridSizer1);
	FlexGridSizer1->Fit(this);
	FlexGridSizer1->SetSizeHints(this);
	Center();

	Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CompilationErrorDialog::OnFermerBtClick);
	Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CompilationErrorDialog::OnAideBtClick);
	//*)

	if (report != "")
	{
		ReportEdit->Clear();
		ReportEdit->AppendText(report);
	}
}
Esempio n. 3
0
int wxGenericImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour )
{
    wxImage img = bitmap.ConvertToImage();
    img.SetMaskColour(maskColour.Red(), maskColour.Green(), maskColour.Blue());
    return Add(wxBitmap(img));
}
Esempio n. 4
0
#include "TileSet.h"
#include "GDCore/Tools/Localization.h"

#include <algorithm>
#include <iostream>
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#include <wx/file.h>
#include <wx/filefn.h>
#include <wx/filename.h>
#include <wx/image.h>
#endif
#include <GDCore/CommonTools.h>

#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
wxBitmap TileSet::m_invalidBitmap = wxBitmap();
#endif

TileHitbox TileHitbox::Rectangle(sf::Vector2f tileSize)
{
    TileHitbox hitbox;
    hitbox.collidable = true;
    hitbox.hitbox = Polygon2d::CreateRectangle(tileSize.x, tileSize.y);
    hitbox.hitbox.Move(tileSize.x/2.f, tileSize.y/2.f);

    return hitbox;
}

TileHitbox TileHitbox::Triangle(sf::Vector2f tileSize, TriangleOrientation orientation)
{
    TileHitbox hitbox;
Esempio n. 5
0
// This sets up the ControlToolBar, initializing all the important values
// and creating the buttons.
void ControlToolBar::InitializeControlToolBar()
{
   mIdealSize = wxSize(420, 55); // ideal for (mShowTools == true)
   mTitle = _("Audacity Control Toolbar");
   mType = ControlToolBarID;
   mShowTools = true;

   wxColour backgroundColour =
      wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
   #if (AUDACITY_BRANDING == BRAND_AUDIOTOUCH)
      this->SetBackgroundColour(*wxBLUE); // blue for Ready
   #endif

   //Read the following wxASSERTs as documentating a design decision
   wxASSERT( selectTool   == ID_SELECT   - ID_FIRST_TOOL );
   wxASSERT( envelopeTool == ID_ENVELOPE - ID_FIRST_TOOL );
   wxASSERT( slideTool    == ID_SLIDE    - ID_FIRST_TOOL );
   wxASSERT( zoomTool     == ID_ZOOM     - ID_FIRST_TOOL );
   wxASSERT( drawTool     == ID_DRAW     - ID_FIRST_TOOL );
   wxASSERT( multiTool    == ID_MULTI    - ID_FIRST_TOOL );

   MakeButtons();
   #if (AUDACITY_BRANDING == BRAND_AUDIOTOUCH)
      mIsLocked = false; // 2009-02-22: No lock button, and mIsLocked defaults false.   mIsLocked = true;
      //mLock->PushDown();
   #endif

   wxImage *sliderOriginal = new wxImage(wxBitmap(Slider).ConvertToImage());
   wxImage *thumbOriginal = new wxImage(wxBitmap(SliderThumb).ConvertToImage());

#ifdef __WXMAC__
   wxImage *sliderNew = sliderOriginal;
   wxImage *thumbNew = thumbOriginal;
#else
   wxImage *sliderNew = ChangeImageColour(sliderOriginal,
                                          backgroundColour);
   wxImage *thumbNew = ChangeImageColour(thumbOriginal,
                                         backgroundColour);
#endif

   delete sliderOriginal;
   delete thumbOriginal;
#ifndef __WXMAC__
   delete sliderNew;
   delete thumbNew;
#endif

   mCurrentTool = selectTool;

   #if (AUDACITY_BRANDING == BRAND_THINKLABS)
      // no tools created for Thinklabs
      mShowTools = false;
   #else 
      mTool[mCurrentTool]->PushDown();
   #endif

   gPrefs->Read("/GUI/AlwaysEnablePlay", &mAlwaysEnablePlay, false);
   gPrefs->Read("/GUI/AlwaysEnablePause", &mAlwaysEnablePause, false);

   mPaused=false;             //Turn the paused state to off
#if 0
   if(!mAlwaysEnablePause)
      mPause->Disable();         //Turn the pause button off.
   gAudioIO->SetAlwaysEnablePause(mAlwaysEnablePause);
#endif

#if 0
#if defined(__WXMAC__)          // && defined(TARGET_CARBON)
   mDivBitmap = new wxBitmap((const char **) Div);
   mMuteBitmap = new wxBitmap((const char **) Mute);
   mLoudBitmap = new wxBitmap((const char **) Loud);
#endif
#endif
}
Esempio n. 6
0
void RoutePoint::Draw( ocpnDC& dc, ChartCanvas *canvas, wxPoint *rpn )
{
    wxPoint r;
    wxRect hilitebox;

    canvas->GetCanvasPointPix( m_lat, m_lon, &r );

    //  return the home point in this dc to allow "connect the dots"
    if( NULL != rpn ) *rpn = r;

    /*if( !m_bIsVisible )     // pjotrc 2010.02.13, 2011.02.24
        return;
    if( !m_bIsActive)  //  An active route point must always be visible
        if( !IsScaVisible( canvas) )          
            return;   */ 
    if ( !IsVisibleSelectable(canvas) ) return;

    //    Optimization, especially apparent on tracks in normal cases
    if( m_IconName == _T("empty") && !m_bShowName && !m_bPtIsSelected ) return;

    wxPen *pen;
    if( m_bBlink )
        pen = g_pRouteMan->GetActiveRoutePointPen();
    else
        pen = g_pRouteMan->GetRoutePointPen();

//    Substitue icon?
    wxBitmap *pbm;
    if( ( m_bIsActive ) && ( m_IconName != _T("mob") ) )
        pbm = pWayPointMan->GetIconBitmap( _T ( "activepoint" ) );
    else
        pbm = m_pbmIcon;

    wxBitmap *pbms = NULL;
    if( (g_ChartScaleFactorExp > 1.0) && !m_bPreScaled ){
        if(m_IconScaleFactor != g_ChartScaleFactorExp){
            wxImage scaled_image = pbm->ConvertToImage();
            int new_width = pbm->GetWidth() * g_ChartScaleFactorExp;
            int new_height = pbm->GetHeight() * g_ChartScaleFactorExp;
            m_ScaledBMP = wxBitmap(scaled_image.Scale(new_width, new_height, wxIMAGE_QUALITY_HIGH));
           
            m_IconScaleFactor = g_ChartScaleFactorExp;
        }
        if( m_ScaledBMP.IsOk() )
            pbm = &m_ScaledBMP;
    }
        
    int sx2 = pbm->GetWidth() / 2;
    int sy2 = pbm->GetHeight() / 2;

//    Calculate the mark drawing extents
    wxRect r1( r.x - sx2, r.y - sy2, sx2 * 2, sy2 * 2 );           // the bitmap extents

    if( m_bShowName ) {
        if( 0 == m_pMarkFont ) {
            m_pMarkFont = FontMgr::Get().GetFont( _( "Marks" ) );
            m_FontColor = FontMgr::Get().GetFontColor( _( "Marks" ) );
            CalculateNameExtents();
        }

        if( m_pMarkFont ) {
            wxRect r2( r.x + m_NameLocationOffsetX, r.y + m_NameLocationOffsetY, m_NameExtents.x,
                    m_NameExtents.y );
            r1.Union( r2 );
        }
    }

    hilitebox = r1;
    hilitebox.x -= r.x;
    hilitebox.y -= r.y;
    float radius;
    if( g_btouch ){
        hilitebox.Inflate( 20 );
        radius = 20.0f;
    }
    else{
        hilitebox.Inflate( 4 );
        radius = 4.0f;
    }

    wxColour hi_colour = pen->GetColour();
    unsigned char transparency = 100;
    if( m_bRPIsBeingEdited ){
        hi_colour = GetGlobalColor( _T ( "YELO1" ) );
        transparency = 150;
    }
    
        
    //  Highlite any selected point
    if( m_bPtIsSelected || m_bRPIsBeingEdited) {
        AlphaBlending( dc, r.x + hilitebox.x, r.y + hilitebox.y, hilitebox.width, hilitebox.height, radius,
                hi_colour, transparency );
    }

    bool bDrawHL = false;

    if( m_bBlink && ( gFrame->nBlinkerTick & 1 ) ) bDrawHL = true;

    if( ( !bDrawHL ) && ( NULL != m_pbmIcon ) ) {
        dc.DrawBitmap( *pbm, r.x - sx2, r.y - sy2, true );
        // on MSW, the dc Bounding box is not updated on DrawBitmap() method.
        // Do it explicitely here for all platforms.
        dc.CalcBoundingBox( r.x - sx2, r.y - sy2 );
        dc.CalcBoundingBox( r.x + sx2, r.y + sy2 );
    }

    if( m_bShowName ) {
        if( m_pMarkFont ) {
            dc.SetFont( *m_pMarkFont );
            dc.SetTextForeground( m_FontColor );

            dc.DrawText( m_MarkName, r.x + m_NameLocationOffsetX, r.y + m_NameLocationOffsetY );
        }
    }

    // Draw waypoint radar rings if activated
    if( m_iWaypointRangeRingsNumber && m_bShowWaypointRangeRings ) {
        double factor = 1.00;
        if( m_iWaypointRangeRingsStepUnits == 1 )          // nautical miles
            factor = 1 / 1.852;

        factor *= m_fWaypointRangeRingsStep;

        double tlat, tlon;
        wxPoint r1;
        ll_gc_ll( m_lat, m_lon, 0, factor, &tlat, &tlon );
        canvas->GetCanvasPointPix( tlat, tlon, &r1 );

        double lpp = sqrt( pow( (double) (r.x - r1.x), 2) +
                           pow( (double) (r.y - r1.y), 2 ) );
        int pix_radius = (int) lpp;

        wxPen ppPen1( m_wxcWaypointRangeRingsColour, 2 );
        wxBrush saveBrush = dc.GetBrush();
        wxPen savePen = dc.GetPen();
        dc.SetPen( ppPen1 );
        dc.SetBrush( wxBrush( m_wxcWaypointRangeRingsColour, wxBRUSHSTYLE_TRANSPARENT ) );

        for( int i = 1; i <= m_iWaypointRangeRingsNumber; i++ )
            dc.StrokeCircle( r.x, r.y, i * pix_radius );
        dc.SetPen( savePen );
        dc.SetBrush( saveBrush );
    }
    
    //  Save the current draw rectangle in the current DC
    //    This will be useful for fast icon redraws
    CurrentRect_in_DC.x = r.x + hilitebox.x;
    CurrentRect_in_DC.y = r.y + hilitebox.y;
    CurrentRect_in_DC.width = hilitebox.width;
    CurrentRect_in_DC.height = hilitebox.height;

    if( m_bBlink ) g_blink_rect = CurrentRect_in_DC;               // also save for global blinker

    delete pbms;        // the potentially scaled bitmap
}
Esempio n. 7
0
void CGameListCtrl::InitBitmaps()
{
	m_imageListSmall = new wxImageList(96, 32);
	SetImageList(m_imageListSmall, wxIMAGE_LIST_SMALL);

	m_FlagImageIndex.resize(DiscIO::IVolume::NUMBER_OF_COUNTRIES);
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_JAPAN]         = m_imageListSmall->Add(wxBitmap(Flag_Japan_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_EUROPE]        = m_imageListSmall->Add(wxBitmap(Flag_Europe_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_USA]           = m_imageListSmall->Add(wxBitmap(Flag_USA_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_AUSTRALIA]     = m_imageListSmall->Add(wxBitmap(Flag_Australia_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_FRANCE]        = m_imageListSmall->Add(wxBitmap(Flag_France_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_GERMANY]       = m_imageListSmall->Add(wxBitmap(Flag_Germany_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_ITALY]         = m_imageListSmall->Add(wxBitmap(Flag_Italy_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_KOREA]         = m_imageListSmall->Add(wxBitmap(Flag_Korea_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_NETHERLANDS]   = m_imageListSmall->Add(wxBitmap(Flag_Netherlands_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_RUSSIA]        = m_imageListSmall->Add(wxBitmap(Flag_Russia_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_SPAIN]         = m_imageListSmall->Add(wxBitmap(Flag_Spain_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_TAIWAN]        = m_imageListSmall->Add(wxBitmap(Flag_Taiwan_xpm));
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_WORLD]         = m_imageListSmall->Add(wxBitmap(Flag_Europe_xpm)); // Uses European flag as a placeholder
	m_FlagImageIndex[DiscIO::IVolume::COUNTRY_UNKNOWN]       = m_imageListSmall->Add(wxBitmap(Flag_Unknown_xpm));

	m_PlatformImageIndex.resize(4);
	m_PlatformImageIndex[0] = m_imageListSmall->Add(wxBitmap(Platform_Gamecube_xpm));
	m_PlatformImageIndex[1] = m_imageListSmall->Add(wxBitmap(Platform_Wii_xpm));
	m_PlatformImageIndex[2] = m_imageListSmall->Add(wxBitmap(Platform_Wad_xpm));
	m_PlatformImageIndex[3] = m_imageListSmall->Add(wxBitmap(StrToWxStr(File::GetSysDirectory() + RESOURCES_DIR + DIR_SEP + "Platform_File.png"), wxBITMAP_TYPE_PNG));

	m_EmuStateImageIndex.resize(6);
	m_EmuStateImageIndex[0] = m_imageListSmall->Add(wxBitmap(rating_0));
	m_EmuStateImageIndex[1] = m_imageListSmall->Add(wxBitmap(rating_1));
	m_EmuStateImageIndex[2] = m_imageListSmall->Add(wxBitmap(rating_2));
	m_EmuStateImageIndex[3] = m_imageListSmall->Add(wxBitmap(rating_3));
	m_EmuStateImageIndex[4] = m_imageListSmall->Add(wxBitmap(rating_4));
	m_EmuStateImageIndex[5] = m_imageListSmall->Add(wxBitmap(rating_5));
}
Esempio n. 8
0
// Paint Handler
void pyuvCanvas::OnPaint(wxPaintEvent& event)
{
#if 0
    // Create a bitmap from our pixel data
    wxBitmap bmp(wxImage(PYUV_WIDTH, PYUV_HEIGHT, (unsigned char *) screen, true));
    wxBitmap bmp(logoimg);
    wxBitmap bmp(*pyuvImg);

    // See this: http://wxforum.shadonet.com/viewtopic.php?t=10654
    // THIS IS WORKING FINE
    wxPaintDC dc(this);
    dc.DrawBitmap(wxBitmap(*pyuvImg), 0, 0, true);

    // look here : http://wxforum.shadonet.com/viewtopic.php?t=9393
    wxBitmap b = wxBitmap(30, 20, -1);
    unsigned int *data = b.GetRawData();
    dc.DrawBitmap(b, 0, 0, true);

    // Working with raw bitmaps
    // Reset iterator
    pyuvPixel->Reset(*pyuvBmpdata);

    // Copy data
    int x, y;
    for (y = 0; y < pyuvHeightS; ++y) {

        *pyuvRowstart = *pyuvPixel;

        for (x = 0; x < pyuvWidthS; ++x, ++(*pyuvPixel)) {

            pyuvPixel->Red()   = pyuvScreen[3 * (y * pyuvWidthS + x)];
            pyuvPixel->Green() = pyuvScreen[3 * (y * pyuvWidthS + x) + 1];
            pyuvPixel->Blue()  = pyuvScreen[3 * (y * pyuvWidthS + x) + 2];
        }

        *pyuvPixel = *pyuvRowstart;
        pyuvPixel->OffsetY(*pyuvBmpdata, 1);
    }
#endif

    if(pyuvFrame::GetDoubleBuffer())
    {
#if 0
        wxBufferedPaintDC dc;

        // Paint the screen with double buffering
        if (pyuvEngine == 1)
            dc((wxWindow *) this, pyuvBmp, wxBUFFER_CLIENT_AREA);
        else
            dc((wxWindow *) this, wxBitmap(*pyuvImg), wxBUFFER_CLIENT_AREA);

        // Show the timecode
        if (pyuvShowtimecode) {

            // Set pen and brush
            dc.SetPen(*wxTRANSPARENT_PEN);
            dc.SetBrush(*wxWHITE_BRUSH);

            // Set font
            dc.SetFont(pyuvTimeFont);
            dc.SetTextForeground(pyuvTimeColour);

            // Background
            dc.DrawRectangle(pyuvTimeBack);

            // Watermark the screen
            dc.DrawText(pyuvCurtime, tcx, tcy);
        };

        // Show the identity
        if (pyuvShowidentity) {

            // Set pen and brush
            dc.SetPen(*wxTRANSPARENT_PEN);

            // Set font
            dc.SetFont(pyuvIdFont);
            dc.SetTextForeground(pyuvIdColour);

            // Background
            if (pyuvServno >= 0)
                dc.SetBrush(pyuvSlaveColors[pyuvServno]);
            else
                dc.SetBrush(*wxWHITE_BRUSH);
            dc.DrawRectangle(pyuvIdBack);

            // Watermark the screen
            dc.DrawText(pyuvApp::GetServerNoString(), idx, idy);
        };
#endif
    }
    else
    {
        // Paint the screen with single buffering
        wxPaintDC dc(this);
        int pyuvEngine = pyuvFrame::GetEngine();

        if(pyuvEngine == 1)
        {
            // raw bitmap
            dc.DrawBitmap(*pyuvBmp, 0, 0, true);
        }
        else
        {
            if(pyuvEngine == 0)
            {
                // normal bitmap
                dc.DrawBitmap(wxBitmap(*pyuvFrame::GetImage()), 0, 0, true);
            }
        }

        // Show the timecode
        if(pyuvFrame::GetShowTimeCodeFlag())
        {
            wxCoord tcx, tcy;
            wxCoord tcwidth, tcheight;

            // Set pen and brush
            dc.SetPen(*wxTRANSPARENT_PEN);
            dc.SetBrush(*wxWHITE_BRUSH);

            // Set font
            dc.SetFont(pyuvFrame::GetTimeFont());
            dc.SetTextForeground(pyuvApp::GetTimeColour());

            // Background
            pyuvFrame::GetTimeCodePosition(tcx, tcy);
            pyuvFrame::GetTimeCodeDimension(tcwidth, tcheight);
            pyuvApp::GetTimeBack() = wxRect(tcx - 2, tcy + 1, tcwidth + 4, tcheight - 2);
            dc.DrawRectangle(pyuvApp::GetTimeBack());

            // Watermark the screen
            dc.DrawText(pyuvFrame::GetCurrentTime2(), tcx, tcy);
        }

        // Show the identity
        if(pyuvFrame::GetShowIdentityFlag())
        {
            wxCoord idx, idy;
            wxCoord idwidth, idheight;

            // Set pen and brush
            dc.SetPen(*wxTRANSPARENT_PEN);

            // Set font
            dc.SetFont(pyuvFrame::GetIdentityFont());
            dc.SetTextForeground(pyuvApp::GetIdColour());

            // Background
            if(pyuvApp::GetServerNo() >= 0)
            {
                dc.SetBrush((*pyuvApp::GetClientColour())[pyuvApp::GetServerNo()]);
            }
            else
            {
                dc.SetBrush(*wxWHITE_BRUSH);
            }
            pyuvFrame::GetIdentityPosition(idx, idy);
            pyuvFrame::GetIdentityDimension(idwidth, idheight);
            pyuvApp::GetIdBack() = wxRect(idx - 2, idy + 0, idwidth + 2, idheight - 2);
            dc.DrawRectangle(pyuvApp::GetIdBack());

            // Watermark the screen
            dc.DrawText(pyuvApp::GetServerNoString(), idx, idy);
        }
    }
}
Esempio n. 9
0
bool CODListBox::SetCBMCharset(byte *buffer, int nLength)
{
	byte *pbInputCharset, *pbOrderedCharset;
	wxBitmap unmaskedStd;
	wxBitmap unmaskedSel;
	wxMask *maskStd;
	wxMask *maskSel;
	wxMemoryDC srcDC;
	wxMemoryDC dstDC;
	int iScreenDepth;
	int iXCnt, iYCnt;
	byte bCharsetByte;


	// allocate memory
	pbInputCharset = (byte*)malloc(0x0800);
	if( pbInputCharset==NULL )
	{
		return false;
	}
	pbOrderedCharset = (byte*)malloc(0x0800);
	if( pbOrderedCharset==NULL )
	{
		free( pbInputCharset );
		return false;
	}

	// construct input charset
	switch( nLength )
	{
	case 2048:
	case 4096:
		// complete charset, no startaddress
		memcpy(pbInputCharset, buffer, 2048);
		break;
	case 2050:
	case 4098:
		// complete charset with startaddress
		memcpy(pbInputCharset, buffer+2, 2048);
		break;
	default:
		free(pbInputCharset);
		free(pbOrderedCharset);
		break;
	}

	// convert charset to bitmap order
	for(iYCnt=0; iYCnt<8; ++iYCnt)
	{
		for(iXCnt=0; iXCnt<256; ++iXCnt)
		{
			bCharsetByte  = pbInputCharset[iYCnt+(iXCnt<<3)];

#ifndef __WIN32__								// don't invert the charset on Win32 systems (my personal flavor)
			bCharsetByte ^= 0xff;
#endif
			bCharsetByte  = abMirrorTab[bCharsetByte];
			pbOrderedCharset[iXCnt+(iYCnt<<8)] = bCharsetByte;
		}
	}

	// get current screen depth
	iScreenDepth = wxDisplayDepth();

	// create a bitmap from the byte array
	wxBitmap charsetBitmapMono((const char*)pbOrderedCharset, 0x0800, 8, 1);

	// free the byte arrays
	free(pbInputCharset);
	free(pbOrderedCharset);

	// create 2 masks from the bitmap
	maskStd = new wxMask(charsetBitmapMono);
	maskSel = new wxMask(charsetBitmapMono);

	unmaskedStd = wxBitmap(0x0800, 8, iScreenDepth);
	unmaskedSel = wxBitmap(0x0800, 8, iScreenDepth);

	stdBitmap = wxBitmap(0x0800, 8, iScreenDepth);
	selBitmap = wxBitmap(0x0800, 8, iScreenDepth);


	srcDC.SelectObject(unmaskedStd);
	srcDC.SetBackground(tBrushStdForeground);
	srcDC.Clear();
	srcDC.SelectObject(wxNullBitmap);

	srcDC.SelectObject(unmaskedSel);
	srcDC.SetBackground(tBrushSelForeground);
	srcDC.Clear();
	srcDC.SelectObject(wxNullBitmap);

	unmaskedStd.SetMask(maskStd);
	unmaskedSel.SetMask(maskSel);

	// clear the destination standard bitmap
	dstDC.SelectObject(stdBitmap);
	dstDC.SetBackground(tBrushStdBackground);
	dstDC.Clear();
	dstDC.SelectObject(wxNullBitmap);

	// clear the destination selected bitmap
	dstDC.SelectObject(selBitmap);
	dstDC.SetBackground(tBrushSelBackground);
	dstDC.Clear();
	dstDC.SelectObject(wxNullBitmap);

	// blit the standard bitmap
	srcDC.SelectObject(unmaskedStd);
	dstDC.SelectObject(stdBitmap);
	dstDC.Blit(0, 0, 0x0800, 8, &srcDC, 0, 0, wxCOPY, true);
	srcDC.SelectObject(wxNullBitmap);
	dstDC.SelectObject(wxNullBitmap);

	srcDC.SelectObject(unmaskedSel);
	dstDC.SelectObject(selBitmap);
	dstDC.Blit(0, 0, 0x0800, 8, &srcDC, 0, 0, wxCOPY, true);
	srcDC.SelectObject(wxNullBitmap);
	dstDC.SelectObject(wxNullBitmap);

	charWidth = 8;
	charHeigth = 8;

	return true;
}
Esempio n. 10
0
ChatPanel* MainChatTab::AddChatPanel( const User& user )
{
	for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) {
		if ( m_chat_tabs->GetPageText( i ) == user.GetNick() ) {
			ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
			if ( tmp->GetPanelType() == CPT_User ) {
				m_chat_tabs->SetSelection( i );
				tmp->SetUser( &user );
				return tmp;
			}
		}
	}
	int selection = m_chat_tabs->GetSelection();
	ChatPanel* chat = new ChatPanel( m_chat_tabs, user, m_imagelist );
	m_chat_tabs->InsertPage( m_chat_tabs->GetPageCount() - 1, chat, user.GetNick(), true, wxBitmap( userchat_xpm ) );
	if ( selection > 0 ) m_chat_tabs->SetSelection( selection );
	return chat;
}
Esempio n. 11
0
MainChatTab::MainChatTab( wxWindow* parent )
    : wxScrolledWindow( parent, -1, wxDefaultPosition, wxDefaultSize, 0, wxPanelNameStr )
{
	GetAui().manager->AddPane( this, wxLEFT, _T( "mainchattab" ) );

	m_newtab_sel = -1;
	m_server_chat = 0;

	m_main_sizer = new wxBoxSizer( wxVERTICAL );

	m_chat_tabs = new SLChatNotebook( this, CHAT_TABS, wxDefaultPosition, wxDefaultSize, wxAUI_NB_DEFAULT_STYLE | wxAUI_NB_TOP | wxAUI_NB_TAB_EXTERNAL_MOVE | wxAUI_NB_WINDOWLIST_BUTTON );
	m_chat_tabs ->SetArtProvider( new SLArtProvider );

	wxBitmap userchat ( userchat_xpm ); //*charArr2wxBitmap(userchat_png, sizeof(userchat_png) );
	m_imagelist = new wxImageList( 12, 12 );
	m_imagelist->Add( wxBitmap( close_xpm ) );
	m_imagelist->Add( wxBitmap( server_xpm ) );
	m_imagelist->Add( wxBitmap( channel_xpm ) );
	m_imagelist->Add( wxBitmap( userchat_xpm ) );

	m_imagelist->Add( wxBitmap ( ReplaceChannelStatusColour( wxBitmap( channel_xpm ), sett().GetChatColorJoinPart() ) ) );
	m_imagelist->Add( wxBitmap ( ReplaceChannelStatusColour( wxBitmap( userchat_xpm ), sett().GetChatColorJoinPart() ) ) );

	m_imagelist->Add( wxBitmap ( ReplaceChannelStatusColour( wxBitmap( channel_xpm ), sett().GetChatColorMine() ) ) );
	m_imagelist->Add( wxBitmap ( ReplaceChannelStatusColour( wxBitmap( userchat_xpm ), sett().GetChatColorMine() ) ) );

	m_imagelist->Add( wxBitmap ( ReplaceChannelStatusColour( wxBitmap( channel_xpm ), sett().GetChatColorHighlight() ) ) );
	m_imagelist->Add( wxBitmap ( ReplaceChannelStatusColour( wxBitmap( userchat_xpm ), sett().GetChatColorHighlight() ) ) );

	m_imagelist->Add( wxBitmap ( ReplaceChannelStatusColour( wxBitmap( server_xpm ), sett().GetChatColorError() ) ) );

	m_main_sizer->Add( m_chat_tabs, 1, wxEXPAND );

	SetSizer( m_main_sizer );
	m_main_sizer->SetSizeHints( this );
	SetScrollRate( SCROLL_RATE, SCROLL_RATE );

	Layout();
}
Esempio n. 12
0
ChatPanel* MainChatTab::AddChatPanel( Channel& channel, bool doFocus )
{

	for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) {
		if ( m_chat_tabs->GetPageText( i ) == channel.GetName() ) {
			ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
			if ( tmp->GetPanelType() == CPT_Channel ) {
				if ( doFocus )
					m_chat_tabs->SetSelection( i );
				tmp->SetChannel( &channel );
				return tmp;
			}
		}
	}

	ChatPanel* chat = new ChatPanel( m_chat_tabs, channel, m_imagelist );
	m_chat_tabs->InsertPage( m_chat_tabs->GetPageCount() - 1, chat, channel.GetName(), doFocus, wxBitmap( channel_xpm ) );
	if ( doFocus )
		chat->FocusInputBox();
	return chat;
}
Esempio n. 13
0
WebFrame::WebFrame(const wxString& url) :
    wxFrame(NULL, wxID_ANY, "wxWebView Sample")
{
    //Required from virtual file system archive support
    wxFileSystem::AddHandler(new wxArchiveFSHandler);

    // set the frame icon
    SetIcon(wxICON(sample));
    SetTitle("wxWebView Sample");

    wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);

    // Create the toolbar
    m_toolbar = CreateToolBar(wxTB_TEXT);
    m_toolbar->SetToolBitmapSize(wxSize(32, 32));

    wxBitmap back = wxArtProvider::GetBitmap(wxART_GO_BACK , wxART_TOOLBAR);
    wxBitmap forward = wxArtProvider::GetBitmap(wxART_GO_FORWARD , wxART_TOOLBAR);
    #ifdef __WXGTK__
        wxBitmap stop = wxArtProvider::GetBitmap("gtk-stop", wxART_TOOLBAR);
    #else
        wxBitmap stop = wxBitmap(stop_xpm);
    #endif
    #ifdef __WXGTK__
        wxBitmap refresh = wxArtProvider::GetBitmap("gtk-refresh", wxART_TOOLBAR);
    #else
        wxBitmap refresh = wxBitmap(refresh_xpm);
    #endif

    m_toolbar_back = m_toolbar->AddTool(wxID_ANY, _("Back"), back);
    m_toolbar_forward = m_toolbar->AddTool(wxID_ANY, _("Forward"), forward);
    m_toolbar_stop = m_toolbar->AddTool(wxID_ANY, _("Stop"), stop);
    m_toolbar_reload = m_toolbar->AddTool(wxID_ANY, _("Reload"),  refresh);
    m_url = new wxTextCtrl(m_toolbar, wxID_ANY, wxT(""),  wxDefaultPosition, wxSize(400, -1), wxTE_PROCESS_ENTER );
    m_toolbar->AddControl(m_url, _("URL"));
    m_toolbar_tools = m_toolbar->AddTool(wxID_ANY, _("Menu"), wxBitmap(wxlogo_xpm));

    m_toolbar->Realize();

    // Create the info panel
    m_info = new wxInfoBar(this);
    topsizer->Add(m_info, wxSizerFlags().Expand());

    // Create the webview
    m_browser = wxWebView::New(this, wxID_ANY, url);
    topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1));

    //We register the wxfs:// protocol for testing purposes
    m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));

    SetSizer(topsizer);

    //Set a more sensible size for web browsing
    SetSize(wxSize(800, 600));

    // Create a log window
    new wxLogWindow(this, _("Logging"));

    // Create the Tools menu
    m_tools_menu = new wxMenu();
    wxMenuItem* print = m_tools_menu->Append(wxID_ANY , _("Print"));
    wxMenuItem* viewSource = m_tools_menu->Append(wxID_ANY , _("View Source"));
    m_tools_menu->AppendSeparator();
    m_tools_layout = m_tools_menu->AppendCheckItem(wxID_ANY, _("Use Layout Zoom"));
    m_tools_tiny = m_tools_menu->AppendCheckItem(wxID_ANY, _("Tiny"));
    m_tools_small = m_tools_menu->AppendCheckItem(wxID_ANY, _("Small"));
    m_tools_medium = m_tools_menu->AppendCheckItem(wxID_ANY, _("Medium"));
    m_tools_large = m_tools_menu->AppendCheckItem(wxID_ANY, _("Large"));
    m_tools_largest = m_tools_menu->AppendCheckItem(wxID_ANY, _("Largest"));
    m_tools_menu->AppendSeparator();
    m_tools_handle_navigation = m_tools_menu->AppendCheckItem(wxID_ANY, _("Handle Navigation"));
    m_tools_handle_new_window = m_tools_menu->AppendCheckItem(wxID_ANY, _("Handle New Windows"));
    m_tools_menu->AppendSeparator();

    //History menu
    m_tools_history_menu = new wxMenu();
    wxMenuItem* clearhist =  m_tools_history_menu->Append(wxID_ANY, _("Clear History"));
    m_tools_enable_history = m_tools_history_menu->AppendCheckItem(wxID_ANY, _("Enable History"));
    m_tools_history_menu->AppendSeparator();

    m_tools_menu->AppendSubMenu(m_tools_history_menu, "History");

    //Create an editing menu
    wxMenu* editmenu = new wxMenu();
    m_edit_cut = editmenu->Append(wxID_ANY, _("Cut"));
    m_edit_copy = editmenu->Append(wxID_ANY, _("Copy"));
    m_edit_paste = editmenu->Append(wxID_ANY, _("Paste"));
    editmenu->AppendSeparator();
    m_edit_undo = editmenu->Append(wxID_ANY, _("Undo"));
    m_edit_redo = editmenu->Append(wxID_ANY, _("Redo"));
    editmenu->AppendSeparator();
    m_edit_mode = editmenu->AppendCheckItem(wxID_ANY, _("Edit Mode"));

    m_tools_menu->AppendSeparator();
    m_tools_menu->AppendSubMenu(editmenu, "Edit");

    wxMenu* scroll_menu = new wxMenu;
    m_scroll_line_up = scroll_menu->Append(wxID_ANY, "Line &up");
    m_scroll_line_down = scroll_menu->Append(wxID_ANY, "Line &down");
    m_scroll_page_up = scroll_menu->Append(wxID_ANY, "Page u&p");
    m_scroll_page_down = scroll_menu->Append(wxID_ANY, "Page d&own");
    m_tools_menu->AppendSubMenu(scroll_menu, "Scroll");

    wxMenuItem* script =  m_tools_menu->Append(wxID_ANY, _("Run Script"));

    //Selection menu
    wxMenu* selection = new wxMenu();
    m_selection_clear = selection->Append(wxID_ANY, _("Clear Selection"));
    m_selection_delete = selection->Append(wxID_ANY, _("Delete Selection"));
    wxMenuItem* selectall = selection->Append(wxID_ANY, _("Select All"));

    editmenu->AppendSubMenu(selection, "Selection");

    wxMenuItem* loadscheme =  m_tools_menu->Append(wxID_ANY, _("Custom Scheme Example"));

    //By default we want to handle navigation and new windows
    m_tools_handle_navigation->Check();
    m_tools_handle_new_window->Check();
    m_tools_enable_history->Check();
    if(!m_browser->CanSetZoomType(wxWEB_VIEW_ZOOM_TYPE_LAYOUT))
        m_tools_layout->Enable(false);


    // Connect the toolbar events
    Connect(m_toolbar_back->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnBack), NULL, this );
    Connect(m_toolbar_forward->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnForward), NULL, this );
    Connect(m_toolbar_stop->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnStop), NULL, this );
    Connect(m_toolbar_reload->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnReload),NULL, this );
    Connect(m_toolbar_tools->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnToolsClicked), NULL, this );

    Connect(m_url->GetId(), wxEVT_COMMAND_TEXT_ENTER,
            wxCommandEventHandler(WebFrame::OnUrl), NULL, this );

    // Connect the webview events
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
            wxWebViewEventHandler(WebFrame::OnNavigationRequest), NULL, this);
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
            wxWebViewEventHandler(WebFrame::OnNavigationComplete), NULL, this);
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_LOADED,
            wxWebViewEventHandler(WebFrame::OnDocumentLoaded), NULL, this);
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_ERROR,
            wxWebViewEventHandler(WebFrame::OnError), NULL, this);
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
            wxWebViewEventHandler(WebFrame::OnNewWindow), NULL, this);
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
            wxWebViewEventHandler(WebFrame::OnTitleChanged), NULL, this);

    // Connect the menu events
    Connect(viewSource->GetId(), wxEVT_COMMAND_MENU_SELECTED,
           wxCommandEventHandler(WebFrame::OnViewSourceRequest),  NULL, this );
    Connect(print->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnPrint),  NULL, this );
    Connect(m_tools_layout->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnZoomLayout),  NULL, this );
    Connect(m_tools_tiny->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
    Connect(m_tools_small->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
    Connect(m_tools_medium->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
    Connect(m_tools_large->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
    Connect(m_tools_largest->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
    Connect(clearhist->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnClearHistory),  NULL, this );
    Connect(m_tools_enable_history->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnEnableHistory),  NULL, this );
    Connect(m_edit_cut->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnCut),  NULL, this );
    Connect(m_edit_copy->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnCopy),  NULL, this );
    Connect(m_edit_paste->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnPaste),  NULL, this );
    Connect(m_edit_undo->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnUndo),  NULL, this );
    Connect(m_edit_redo->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnRedo),  NULL, this );
    Connect(m_edit_mode->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnMode),  NULL, this );
    Connect(m_scroll_line_up->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnScrollLineUp),  NULL, this );
    Connect(m_scroll_line_down->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnScrollLineDown),  NULL, this );
    Connect(m_scroll_page_up->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnScrollPageUp),  NULL, this );
    Connect(m_scroll_page_down->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnScrollPageDown),  NULL, this );
    Connect(script->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnRunScript),  NULL, this );
    Connect(m_selection_clear->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnClearSelection),  NULL, this );
    Connect(m_selection_delete->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnDeleteSelection),  NULL, this );
    Connect(selectall->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSelectAll),  NULL, this );
    Connect(loadscheme->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnLoadScheme),  NULL, this );

    //Connect the idle events
    Connect(wxID_ANY, wxEVT_IDLE, wxIdleEventHandler(WebFrame::OnIdle), NULL, this);
}
Esempio n. 14
0
mxProfile::mxProfile(wxWindow *parent):wxDialog(parent,wxID_ANY,_Z("Opciones del Lenguaje"),wxDefaultPosition,wxDefaultSize),old_config(LS_INIT) {
	
	text=NULL; // para que no procese el evento de seleccion al crear la lista
	
	old_config=config->lang;
	old_profile=config->profile;
	
	wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
	
	wxBoxSizer *search_sizer = new wxBoxSizer(wxHORIZONTAL);
	search=new wxTextCtrl(this,wxID_FIND,"");
	search_sizer->Add(new wxStaticText(this,wxID_ANY,_Z("Buscar: ")),wxSizerFlags().Center());
	search_sizer->Add(search,wxSizerFlags().Proportion(1).Expand());
	
	sizer->Add(search_sizer,wxSizerFlags().Proportion(0).Expand().Border(wxALL,5));
	
	wxBoxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL);

	wxDir dir(config->profiles_dir);
	if ( dir.IsOpened() ) {
		wxString filename;
		wxString spec;
		bool cont = dir.GetFirst(&filename, spec , wxDIR_FILES);
		while ( cont ) {
			perfiles.Add(filename);
			cont = dir.GetNext(&filename);
		}
	}
	perfiles.Sort(comp_nocase);
	for(unsigned int i=0;i<perfiles.GetCount();i++) { 
		LangSettings l(LS_INIT); l.Load(DIR_PLUS_FILE(config->profiles_dir,perfiles[i]));
		descripciones.Add(l.descripcion.c_str());
	}
	
	list = new wxListCtrl(this,wxID_ANY,wxDefaultPosition,wxSize(250,250),wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL);
	list->InsertColumn(0,_Z("Perfil"));
	wxImageList *iml = new wxImageList(24,24,true);
	wxBitmap noimage(DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),"null.png"),wxBITMAP_TYPE_PNG);
	for(unsigned int i=0;i<perfiles.GetCount();i++) {
		wxString ficon=DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),perfiles[i]+".png");
		if (wxFileName::FileExists(ficon))
			iml->Add(wxBitmap(ficon,wxBITMAP_TYPE_PNG));
		else
			iml->Add(noimage);
	}
	iml->Add(wxBitmap(DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),"personalizado.png"),wxBITMAP_TYPE_PNG));
	list->AssignImageList(iml,wxIMAGE_LIST_SMALL);
	
	Search();
	
	text = new wxTextCtrl(this,wxID_ANY,_T(""),wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY);
	LoadProfile();
	
	wxButton *options_button = new mxBitmapButton (this, wxID_ABOUT, bitmaps->buttons.next, _Z("Personalizar..."));
	wxButton *ok_button = new mxBitmapButton (this, wxID_OK, bitmaps->buttons.ok, _Z("Aceptar"));
	wxButton *cancel_button = new mxBitmapButton (this, wxID_CANCEL, bitmaps->buttons.cancel, _Z("Cancelar"));
	button_sizer->Add(options_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand());
	button_sizer->AddStretchSpacer(1);
	button_sizer->Add(cancel_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand());
	button_sizer->Add(ok_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand());
	
	sizer->Add(new wxStaticText(this,wxID_ANY,_Z(" Seleccione un perfil para configurar las reglas de su pseudocódigo:  ")),wxSizerFlags().Expand().Proportion(0).Border(wxTOP,5));
	sizer->Add(list,wxSizerFlags().Expand().Proportion(2).FixedMinSize());
	sizer->Add(new wxStaticText(this,wxID_ANY,_Z("")),wxSizerFlags().Expand().Proportion(0));
	sizer->Add(new wxStaticText(this,wxID_ANY,_Z(" Descripción del perfil seleccionado:")),wxSizerFlags().Expand().Proportion(0));
	sizer->Add(text,wxSizerFlags().Expand().Proportion(1).FixedMinSize());
	sizer->Add(new wxStaticText(this,wxID_ANY,""),wxSizerFlags().Expand().Proportion(0));
	sizer->Add(button_sizer,wxSizerFlags().Expand().Proportion(0));
	
	ok_button->SetDefault();
	SetEscapeId(wxID_CANCEL);
	
	SetSizerAndFit(sizer);
	
	this->Layout(); // para ajustar el tamaño de la columna de la lista
	list->SetColumnWidth(0,list->GetSize().GetWidth()-32);
	
	search->SetFocus();
	
	ShowModal();
}
Esempio n. 15
0
void LocSelDlg::InitValues() {
  TraceOp.trc( "app", TRCLEVEL_INFO, __LINE__, 9999, "InitValues %s", wLoc.getid( m_Props ) );
  // Init General
  if( wLoc.getimage( m_Props ) != NULL && StrOp.len(wLoc.getimage(m_Props)) > 0 ) {
    bool isSupported = true;
    wxBitmapType bmptype = wxBITMAP_TYPE_XPM;
    if( StrOp.endsWithi( wLoc.getimage( m_Props ), ".gif" ) )
      bmptype = wxBITMAP_TYPE_GIF;
    else if( StrOp.endsWithi( wLoc.getimage( m_Props ), ".png" ) )
      bmptype = wxBITMAP_TYPE_PNG;
    else {
      TraceOp.trc( "locseldlg", TRCLEVEL_WARNING, __LINE__, 9999, "unsupported image format %s", wLoc.getimage( m_Props ) );
      isSupported = false;
    }


    const char* imagepath = wGui.getimagepath(wxGetApp().getIni());
    const char* imagename = FileOp.ripPath( wLoc.getimage( m_Props ) );
    static char pixpath[256];
    StrOp.fmtb( pixpath, "%s%c%s", imagepath, SystemOp.getFileSeparator(), imagename );

    if( isSupported && imagename != NULL && StrOp.len(imagename) > 0 && FileOp.exist(pixpath)) {
      TraceOp.trc( "locseldlg", TRCLEVEL_INFO, __LINE__, 9999, "picture [%s]", pixpath );
      wxImage img(wxString(pixpath,wxConvUTF8), bmptype);
      if( img.IsOk() && img.GetHeight() > MAXHEIGHT ) {
        int h = img.GetHeight();
        int w = img.GetWidth();
        float scale = (float)h / (float)MAXHEIGHT;
        float width = (float)w / scale;
        wxBitmap bmp(img.Scale((int)width, MAXHEIGHT, wxIMAGE_QUALITY_HIGH));
        m_LocImageIndex->SetBitmapLabel( bmp );
      }
      else if(img.IsOk()) {
        m_LocImageIndex->SetBitmapLabel( wxBitmap(img) );
      }
    }
    else {
      if( wGui.isgrayicons(wxGetApp().getIni()) )
        m_LocImageIndex->SetBitmapLabel( *_img_noimg );
      else
        m_LocImageIndex->SetBitmapLabel( wxBitmap(nopict_xpm) );
      if( isSupported && StrOp.len(imagename) > 0 ) {
        TraceOp.trc( "locdlg", TRCLEVEL_INFO, __LINE__, 9999, "picture [%s] not found; request it from server.", pixpath );
        // request the image from server:
        iONode node = NodeOp.inst( wDataReq.name(), NULL, ELEMENT_NODE );
        wDataReq.setid( node, wLoc.getid(m_Props) );
        wDataReq.setcmd( node, wDataReq.get );
        wDataReq.settype( node, wDataReq.image );
        wDataReq.setfilename( node, imagename );
        wxGetApp().sendToRocrail( node );
      }
    }
    m_LocImageIndex->SetToolTip(wxString(wLoc.getdesc( m_Props ),wxConvUTF8));


    //m_LocImage->SetBitmapLabel( wxBitmap(wxString(wLoc.getimage( m_Props ),wxConvUTF8), bmptype) );
    //m_LocImageIndex->SetBitmapLabel( wxBitmap(wxString(wLoc.getimage( m_Props ),wxConvUTF8), bmptype) );
  }
  else {
    if( wGui.isgrayicons(wxGetApp().getIni()) )
      m_LocImageIndex->SetBitmapLabel( *_img_noimg );
    else
      m_LocImageIndex->SetBitmapLabel( wxBitmap(nopict_xpm) );
    //m_LocImageIndex->SetBitmapLabel( wxBitmap(nopict_xpm) );
  }
  m_LocImageIndex->Refresh();
  GetSizer()->Fit(this);
  GetSizer()->Layout();

}
Esempio n. 16
0
void wxTabNavigatorWindow::Create(wxWindow* parent)
{
	long style = 0;
	if(  !wxDialog::Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, style) )
		return;

	wxBoxSizer *sz = new wxBoxSizer( wxVERTICAL );
	SetSizer( sz );

	long flags = wxLB_SINGLE | wxNO_BORDER ;
	m_listBox = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxSize(200, 150), 0, NULL, flags);

	static int panelHeight = 0;
	if( panelHeight == 0 )
	{
		wxMemoryDC mem_dc;

		// bitmap must be set before it can be used for anything
		wxBitmap bmp(10, 10);
		mem_dc.SelectObject(bmp);

		wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
		font.SetWeight( wxBOLD );
		mem_dc.SetFont(font);
		int w;
		mem_dc.GetTextExtent(wxT("Tp"), &w, &panelHeight);
		panelHeight += 4; // Place a spacer of 2 pixels

		// Out signpost bitmap is 24 pixels
		if( panelHeight < 24 )
			panelHeight = 24;
	}

	m_panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize(200, panelHeight));

	sz->Add( m_panel );
	sz->Add( m_listBox, 1, wxEXPAND );
	
	SetSizer( sz );

	// Connect events to the list box
	m_listBox->Connect(wxID_ANY, wxEVT_KEY_UP, wxKeyEventHandler(wxTabNavigatorWindow::OnKeyUp), NULL, this); 
	m_listBox->Connect(wxID_ANY, wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(wxTabNavigatorWindow::OnNavigationKey), NULL, this); 
	m_listBox->Connect(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler(wxTabNavigatorWindow::OnItemSelected), NULL, this);
	
	// Connect paint event to the panel
	m_panel->Connect(wxID_ANY, wxEVT_PAINT, wxPaintEventHandler(wxTabNavigatorWindow::OnPanelPaint), NULL, this);
	m_panel->Connect(wxID_ANY, wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(wxTabNavigatorWindow::OnPanelEraseBg), NULL, this);

	SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) );
	m_listBox->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
	PopulateListControl( static_cast<wxFlatNotebook*>( parent ) );

	// Create the bitmap, only once
	if( !m_bmp.Ok() )
	{
		wxImage img(signpost_xpm);
		img.SetAlpha(signpost_alpha, true);
		m_bmp =  wxBitmap(img); 
	}
}
Esempio n. 17
0
void RoutePoint::EnableDragHandle(bool bEnable)
{
    m_bDrawDragHandle = bEnable;
    if(bEnable){
        if(!m_dragIcon.IsOk()){    
            // Get the icon
            // What size?
            int bm_size = g_Platform->GetDisplayDPmm() * 9;     //9 mm nominal
        
            // What icon?
            wxString UserIconPath = g_Platform->GetSharedDataDir() + _T("uidata") + wxFileName::GetPathSeparator();
            
            wxImage iconSVG = LoadSVGIcon( UserIconPath  + _T("DragHandle.svg"), bm_size, bm_size );
            if(iconSVG.IsOk())
                m_dragIcon = wxBitmap(iconSVG);
            else
                m_dragIcon = *m_pbmIcon;                // Drag handle icon not found
                
            // build a texture
#ifdef ocpnUSE_GL
        /* make rgba texture */
            if(m_dragIconTexture == 0){
                glGenTextures(1, &m_dragIconTexture);
                glBindTexture(GL_TEXTURE_2D, m_dragIconTexture);
                    
                glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
                glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
                glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
            
            
                wxImage image = iconSVG;
                int w = image.GetWidth(), h = image.GetHeight();
            
                m_dragIconTextureWidth = NextPow2(w);
                m_dragIconTextureHeight = NextPow2(h);
            
                unsigned char *d = image.GetData();
                unsigned char *a = image.GetAlpha();
                
                unsigned char mr, mg, mb;
                image.GetOrFindMaskColour( &mr, &mg, &mb );
        
                unsigned char *e = new unsigned char[4 * w * h];
                if(d && e){
                    for( int y = 0; y < h; y++ )
                        for( int x = 0; x < w; x++ ) {
                            unsigned char r, g, b;
                            int off = ( y * image.GetWidth() + x );
                            r = d[off * 3 + 0];
                            g = d[off * 3 + 1];
                            b = d[off * 3 + 2];
                            e[off * 4 + 0] = r;
                            e[off * 4 + 1] = g;
                            e[off * 4 + 2] = b;
                        
                            e[off * 4 + 3] =  a ? a[off] : ( ( r == mr ) && ( g == mg ) && ( b == mb ) ? 0 : 255 );
                        }
                }
        
                glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_dragIconTextureWidth, m_dragIconTextureHeight,
                        0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
                glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h,
                            GL_RGBA, GL_UNSIGNED_BYTE, e);

                delete [] e;
            }
#endif

            // set the drawing metrics
            if(iconSVG.IsOk()){
                m_drag_line_length_man = bm_size;
                m_drag_icon_offset = bm_size;
            }
            else{
                m_drag_line_length_man = 64;
                m_drag_icon_offset = 64;
            }
        }
    }
}
Esempio n. 18
0
SearchInPanel::SearchInPanel(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size, long WXUNUSED(style)):
    wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL)
{
    //{ Getting the imagesize for the buttons (16x16 or 22x22) and the appropriate path
    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
    bool toolbar_size = cfg->ReadBool(_T("/environment/toolbar_size"),true);
    wxString prefix = ConfigManager::GetDataFolder() + _T("/images/ThreadSearch/") + (toolbar_size?_T("16x16/"):_T("22x22/"));

    // create a dummy button to get the standard button-size,
    // wxCustomButton does not do that properly
    // we have to force this size as MinSize to make it work
    wxBitmapButton dummyBtn(this, wxID_ANY, wxBitmap(prefix + wxT("openfiles.png"), wxBITMAP_TYPE_PNG));
    wxSize dummySize = dummyBtn.GetSize();

    m_pBtnSearchOpenFiles = new wxCustomButton(this, controlIDs.Get(ControlIDs::idBtnSearchOpenFiles),
                                               wxBitmap(prefix + wxT("openfiles.png"), wxBITMAP_TYPE_PNG),
                                               wxDefaultPosition, dummySize);
    m_pBtnSearchOpenFiles->SetBitmapDisabled(wxBitmap(prefix + wxT("openfilesdisabled.png"), wxBITMAP_TYPE_PNG));
    m_pBtnSearchOpenFiles->SetBitmapSelected(wxBitmap(prefix + wxT("openfilesselected.png"), wxBITMAP_TYPE_PNG));
    m_pBtnSearchOpenFiles->SetMinSize(dummySize);
    m_pBtnSearchTargetFiles = new wxCustomButton(this, controlIDs.Get(ControlIDs::idBtnSearchTargetFiles),
                                                 wxBitmap(prefix + wxT("target.png"), wxBITMAP_TYPE_PNG),
                                                 wxDefaultPosition, dummySize);
    m_pBtnSearchTargetFiles->SetBitmapDisabled(wxBitmap(prefix + wxT("targetdisabled.png"), wxBITMAP_TYPE_PNG));
    m_pBtnSearchTargetFiles->SetBitmapSelected(wxBitmap(prefix + wxT("targetselected.png"), wxBITMAP_TYPE_PNG));
    m_pBtnSearchTargetFiles->SetMinSize(dummySize);
    m_pBtnSearchProjectFiles = new wxCustomButton(this, controlIDs.Get(ControlIDs::idBtnSearchProjectFiles),
                                                  wxBitmap(prefix + wxT("project.png"), wxBITMAP_TYPE_PNG),
                                                  wxDefaultPosition, dummySize);
    m_pBtnSearchProjectFiles->SetBitmapDisabled(wxBitmap(prefix + wxT("projectdisabled.png"), wxBITMAP_TYPE_PNG));
    m_pBtnSearchProjectFiles->SetBitmapSelected(wxBitmap(prefix + wxT("projectselected.png"), wxBITMAP_TYPE_PNG));
    m_pBtnSearchProjectFiles->SetMinSize(dummySize);
    m_pBtnSearchWorkspaceFiles = new wxCustomButton(this, controlIDs.Get(ControlIDs::idBtnSearchWorkspaceFiles),
                                                    wxBitmap(prefix + wxT("workspace.png"), wxBITMAP_TYPE_PNG),
                                                    wxDefaultPosition, dummySize);
    m_pBtnSearchWorkspaceFiles->SetBitmapDisabled(wxBitmap(prefix + wxT("workspacedisabled.png"), wxBITMAP_TYPE_PNG));
    m_pBtnSearchWorkspaceFiles->SetBitmapSelected(wxBitmap(prefix + wxT("workspaceselected.png"), wxBITMAP_TYPE_PNG));
    m_pBtnSearchWorkspaceFiles->SetMinSize(dummySize);
    m_pBtnSearchDir = new wxCustomButton(this, controlIDs.Get(ControlIDs::idBtnSearchDirectoryFiles),
                                         wxBitmap(prefix + wxT("folder.png"), wxBITMAP_TYPE_PNG),
                                         wxDefaultPosition, dummySize);
    m_pBtnSearchDir->SetBitmapDisabled(wxBitmap(prefix + wxT("folderdisabled.png"), wxBITMAP_TYPE_PNG));
    m_pBtnSearchDir->SetBitmapSelected(wxBitmap(prefix + wxT("folderselected.png"), wxBITMAP_TYPE_PNG));
    m_pBtnSearchDir->SetMinSize(dummySize);

    set_properties();
    do_layout();
    // end wxGlade
}
Esempio n. 19
0
void AccDecDlg::initValues() {
  TraceOp.trc( "accdecdlg", TRCLEVEL_INFO, __LINE__, 9999, "initValues" );
  if( m_Props == NULL ) {
    TraceOp.trc( "accdecdlg", TRCLEVEL_DEBUG, __LINE__, 9999, "no dec selected" );
    return;
  }

  m_CVDescModify->Enable(false);
  m_CVDescription->Enable(false);

  char* title = StrOp.fmt( "%s %s", (const char*)wxGetApp().getMsg("decoder").mb_str(wxConvUTF8), wDec.getid( m_Props ) );
  SetTitle( wxString(title,wxConvUTF8) );
  StrOp.free( title );

  // Init General
  if( wDec.getimage( m_Props ) != NULL && StrOp.len(wDec.getimage( m_Props )) > 0 ) {
    wxBitmapType bmptype = wxBITMAP_TYPE_XPM;
    if( StrOp.endsWithi( wDec.getimage( m_Props ), ".gif" ) )
      bmptype = wxBITMAP_TYPE_GIF;
    else if( StrOp.endsWithi( wDec.getimage( m_Props ), ".png" ) )
      bmptype = wxBITMAP_TYPE_PNG;

    const char* imagepath = wGui.getimagepath(wxGetApp().getIni());
    static char pixpath[256];
    StrOp.fmtb( pixpath, "%s%c%s", imagepath, SystemOp.getFileSeparator(), FileOp.ripPath( wDec.getimage( m_Props ) ) );

    if( FileOp.exist(pixpath) && StrOp.len(wDec.getimage( m_Props )) > 0 ) {
      TraceOp.trc( "accdecdlg", TRCLEVEL_INFO, __LINE__, 9999, "picture [%s]", pixpath );
      m_Image->SetBitmapLabel( wxBitmap(wxString(pixpath,wxConvUTF8), bmptype) );
    }
    else {
      TraceOp.trc( "accdecdlg", TRCLEVEL_WARNING, __LINE__, 9999, "picture [%s] not found", pixpath );
      m_Image->SetBitmapLabel( wxBitmap(nopict_xpm) );
      // request the image from server:
      iONode node = NodeOp.inst( wDataReq.name(), NULL, ELEMENT_NODE );
      wDataReq.setid( node, wDec.getid(m_Props) );
      wDataReq.setcmd( node, wDataReq.get );
      wDataReq.settype( node, wDataReq.image );
      wDataReq.setfilename( node, wDec.getimage(m_Props) );
      wxGetApp().sendToRocrail( node );
    }
  }
  else {
    m_Image->SetBitmapLabel( wxBitmap(nopict_xpm) );
  }
  m_Image->Refresh();

  // init General
  m_ID->SetValue( wxString(wDec.getid( m_Props ),wxConvUTF8) );
  m_IID->SetValue( wxString(wDec.getiid( m_Props ),wxConvUTF8) );
  char* str = StrOp.fmt( "%d", wDec.getbus( m_Props ) );
  m_Bus->SetValue( wxString(str,wxConvUTF8) ); StrOp.free( str );
  m_Addr->SetValue( wDec.getaddr( m_Props ) );
  m_Desc->SetValue( wxString(wDec.getdesc( m_Props ),wxConvUTF8) );

  if( StrOp.equals( wSwitch.prot_M, wDec.getprot( m_Props ) ) )
    m_Protocol->SetSelection( 1 );
  else if( StrOp.equals( wSwitch.prot_N, wDec.getprot( m_Props ) ) )
    m_Protocol->SetSelection( 2 );
  else
    m_Protocol->SetSelection( 0 );

  m_Version->SetValue( wDec.getprotver( m_Props) );
  m_Manu->SetValue( wxString(wDec.getmanu( m_Props ),wxConvUTF8) );
  m_CatNr->SetValue( wxString(wDec.getcatnr( m_Props ),wxConvUTF8) );
  m_ImageFile->SetValue( wxString(wDec.getimage( m_Props ),wxConvUTF8) );

  // CV's
  TraceOp.trc( "locdlg", TRCLEVEL_INFO, __LINE__, 9999, "CV list...");
  iOList list = ListOp.inst();
  iONode cv = wDec.getcvbyte( m_Props );
  while( cv != NULL ) {
    if( wCVByte.getnr( cv ) > 0 && wCVByte.getnr( cv ) <= 1024 ) {
      ListOp.add(list, (obj)cv);
    }
    cv = wDec.nextcvbyte( m_Props, cv );
  };

  TraceOp.trc( "locdlg", TRCLEVEL_INFO, __LINE__, 9999, "CVs...");
  if( m_CVList->GetNumberRows() > 0 )
    m_CVList->DeleteRows( 0, m_CVList->GetNumberRows() );
  ListOp.sort(list, &__sortCV);
  int cnt = ListOp.size( list );
  for( int i = 0; i < cnt && cnt < 1024; i++ ) {
    iONode cv = (iONode)ListOp.get( list, i );
    char* cvnr = StrOp.fmt( "%d", wCVByte.getnr( cv ) );
    char* cvval = StrOp.fmt( "%d", wCVByte.getvalue( cv ) );
    const char* cvdesc = wCVByte.getdesc(cv);
    m_CVNodes[wCVByte.getnr( cv )] = cv;
    m_CVList->AppendRows();
    int row = m_CVList->GetNumberRows()-1;
    m_CVList->SetCellValue(row, 0, wxString(cvnr,wxConvUTF8) );
    m_CVList->SetCellValue(row, 1, wxString(cvval,wxConvUTF8) );
    if( cvdesc != NULL && StrOp.len(cvdesc) > 0 )
      m_CVList->SetCellValue(row, 2, wxString(cvdesc,wxConvUTF8) );
    else
      m_CVList->SetCellValue(row, 2, wxString(m_CVDesc[wCVByte.getnr( cv )&0xff],wxConvUTF8) );
    m_CVList->SetReadOnly( row, 0, true );
    m_CVList->SetReadOnly( row, 1, true );
    m_CVList->SetReadOnly( row, 2, true );
    StrOp.free( cvnr );
    StrOp.free( cvval );
  }
  /* clean up the temp. list */
  ListOp.base.del(list);
  m_CVList->AutoSizeColumns();

}
Esempio n. 20
0
void MainFrame::CreateChildWindows(void)
{
	Omega::uint32_t split_width = 100;
	Omega::uint32_t split_width2 = 100;
	Omega::uint32_t col_width[3] = { 100, 100, 100 };
	Omega::string_t strSelection;

	try
	{
		// get some defaults...
		OTL::ObjectPtr<Omega::Registry::IKey> ptrKey(L"Local User/Applications/OORegEdit/Layout");

		wxPoint ptPos;
		ptPos.x = ptrKey->GetValue(L"Left").cast<int>();
		ptPos.y = ptrKey->GetValue(L"Top").cast<int>();
		SetPosition(ptPos);

		wxSize sz;
		sz.x = ptrKey->GetValue(L"Width").cast<int>();
		sz.y = ptrKey->GetValue(L"Height").cast<int>();
		SetSize(sz);

		split_width = ptrKey->GetValue(L"SplitWidth").cast<Omega::uint32_t>();
		split_width2 = ptrKey->GetValue(L"SplitWidth2").cast<Omega::uint32_t>();

		col_width[0] = ptrKey->GetValue(L"ColWidth0").cast<Omega::uint32_t>();
		col_width[1] = ptrKey->GetValue(L"ColWidth1").cast<Omega::uint32_t>();
		col_width[2] = ptrKey->GetValue(L"ColWidth2").cast<Omega::uint32_t>();

		strSelection = ptrKey->GetValue(L"Selection").cast<Omega::string_t>();

		m_bKeys = ptrKey->GetValue(L"FindKeys").cast<Omega::bool_t>();
		m_bValues = ptrKey->GetValue(L"FindValues").cast<Omega::bool_t>();
		m_bData = ptrKey->GetValue(L"FindData").cast<Omega::bool_t>();
		m_bMatchAll = ptrKey->GetValue(L"MatchAll").cast<Omega::bool_t>();
		m_bIgnoreCase = ptrKey->GetValue(L"IgnoreCase").cast<Omega::bool_t>();

		for (int nFiles = ptrKey->GetValue(L"Favourites").cast<int>()-1;nFiles>=0;--nFiles)
		{
			Omega::string_t val = ptrKey->GetValue(Omega::string_t(L"Favourite{0}") % nFiles).cast<Omega::string_t>();

			size_t pos = val.ReverseFind(L'/');
			if (pos != Omega::string_t::npos)
			{
				wxString strName(val.Mid(pos+1).c_wstr());
				m_fileHistory.AddFileToHistory(strName);

				m_mapMRU.insert(std::map<wxString,Omega::string_t>::value_type(strName,val.Left(pos)));
			}
		}
	}
	catch (Omega::IException* e)
	{
		e->Release();
	}

	// Create the splitter
	m_pSplitter2 = new wxSplitterWindow(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxNO_BORDER | wxSP_LIVE_UPDATE);
	m_pSplitter2->SetSashGravity(0.90);
	m_pSplitter2->SetMinimumPaneSize(50);

	// Create the second splitter
	m_pSplitter = new wxSplitterWindow(m_pSplitter2,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxNO_BORDER | wxSP_LIVE_UPDATE);
	m_pSplitter->SetSashGravity(0.25);
	m_pSplitter->SetMinimumPaneSize(150);

	// Create the list and tree
	m_pList = new wxListCtrl(m_pSplitter,ID_LIST,wxPoint(0,0),wxSize(0,0),wxLC_SORT_ASCENDING | wxLC_REPORT | wxLC_NO_SORT_HEADER | wxLC_EDIT_LABELS);
	m_pTree = new wxTreeCtrl(m_pSplitter,ID_TREE,wxPoint(0,0),wxSize(0,0),wxTR_DEFAULT_STYLE | wxTR_SINGLE | wxTR_EDIT_LABELS);

	// Load the imagelist
	wxImageList* pImagelist = new wxImageList(16,16);
	pImagelist->Add(wxBitmap(imagelist));

	m_pList->SetImageList(pImagelist,wxIMAGE_LIST_SMALL);
	m_pTree->AssignImageList(pImagelist);

	// Create the description text field
#if defined(__WINDOWS__)
	OSVERSIONINFO os = {0};
	os.dwOSVersionInfoSize = sizeof(os);
	GetVersionEx(&os);
	if (os.dwMajorVersion >= 6)
		m_pDescription = new wxHtmlWindow(m_pSplitter2,ID_DESC,wxPoint(0,0),wxSize(0,0),wxBORDER_SIMPLE  | wxHW_SCROLLBAR_NEVER);
	else
		m_pDescription = new wxHtmlWindow(m_pSplitter2,ID_DESC,wxPoint(0,0),wxSize(0,0),wxBORDER_SUNKEN | wxHW_SCROLLBAR_NEVER);
#else
	m_pDescription = new wxHtmlWindow(m_pSplitter2,ID_DESC,wxPoint(0,0),wxSize(0,0),wxBORDER_SUNKEN | wxHW_SCROLLBAR_NEVER);
#endif

	wxFont ft = m_pTree->GetFont();
	m_pDescription->SetFonts(ft.GetFaceName(),wxT(""));
	m_pDescription->SetBorders(1);

	m_pSplitter->SplitVertically(m_pTree, m_pList, split_width);
	m_pSplitter2->SplitHorizontally(m_pSplitter, m_pDescription, split_width2);

	// Init the list
	wxListItem itemCol;
	itemCol.SetText(_("Name"));
	m_pList->InsertColumn(0,itemCol);
	m_pList->SetColumnWidth(0, col_width[0]);
	itemCol.SetText(_("Type"));
	m_pList->InsertColumn(1,itemCol);
	m_pList->SetColumnWidth(1, col_width[1]);
	itemCol.SetText(_("Data"));
	m_pList->InsertColumn(2,itemCol);
	m_pList->SetColumnWidth(2, col_width[2]);

	try
	{
		// Open the registry root
		OTL::ObjectPtr<Omega::Registry::IKey> ptrKey(L"");

		// Init the tree
		TreeItemData* pItem = new TreeItemData(ptrKey,5);
		wxTreeItemId tree_id = m_pTree->AddRoot(_("Local Computer"),0,0,pItem);
		pItem->Fill(m_pTree,tree_id);
		m_pTree->Expand(tree_id);

		SelectItem(strSelection);
	}
	catch (Omega::IException* pE)
	{
		wxMessageBox(pE->GetDescription().c_wstr(),_("System Error"),wxOK|wxICON_ERROR,this);
		pE->Release();
	}
}
Esempio n. 21
0
wxGISCheckList::wxGISCheckList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) : wxListView(parent, id, pos, size, style, validator, name)
{
    m_CheckImageList.Create(16, 16);
	m_CheckImageList.Add(wxBitmap(check_marks_xpm));
    SetImageList(&m_CheckImageList, wxIMAGE_LIST_SMALL);
}
Esempio n. 22
0
bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
      const wxPoint &pos, const wxSize &size,
      long style, const wxString &name )
{
    m_miniTitle = 0;
    if (style & wxCAPTION)
        m_miniTitle = 16;

    if (style & wxRESIZE_BORDER)
        m_miniEdge = 4;
    else
        m_miniEdge = 3;
    m_isDragging = false;
    m_oldX = -1;
    m_oldY = -1;
    m_diffX = 0;
    m_diffY = 0;

    // don't allow sizing smaller than decorations
    int minWidth = 2 * m_miniEdge;
    int minHeight = 2 * m_miniEdge + m_miniTitle;
    if (m_minWidth < minWidth)
        m_minWidth = minWidth;
    if (m_minHeight < minHeight)
        m_minHeight = minHeight;

    wxFrame::Create( parent, id, title, pos, size, style, name );

    // Use a GtkEventBox for the title and borders. Using m_widget for this
    // almost works, except that setting the resize cursor has no effect.
    GtkWidget* eventbox = gtk_event_box_new();
    gtk_widget_add_events(eventbox,
        GDK_POINTER_MOTION_MASK |
        GDK_POINTER_MOTION_HINT_MASK);
    gtk_widget_show(eventbox);
#ifdef __WXGTK3__
    g_object_ref(m_mainWidget);
    gtk_container_remove(GTK_CONTAINER(m_widget), m_mainWidget);
    gtk_container_add(GTK_CONTAINER(eventbox), m_mainWidget);
    g_object_unref(m_mainWidget);

    gtk_widget_set_margin_start(m_mainWidget, m_miniEdge);
    gtk_widget_set_margin_end(m_mainWidget, m_miniEdge);
    gtk_widget_set_margin_top(m_mainWidget, m_miniTitle + m_miniEdge);
    gtk_widget_set_margin_bottom(m_mainWidget, m_miniEdge);
#else
    // Use a GtkAlignment to position m_mainWidget inside the decorations
    GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1);
    gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),
        m_miniTitle + m_miniEdge, m_miniEdge, m_miniEdge, m_miniEdge);
    gtk_widget_show(alignment);
    // The GtkEventBox and GtkAlignment go between m_widget and m_mainWidget
    gtk_widget_reparent(m_mainWidget, alignment);
    gtk_container_add(GTK_CONTAINER(eventbox), alignment);
#endif
    gtk_container_add(GTK_CONTAINER(m_widget), eventbox);

    m_gdkDecor = 0;
    gtk_window_set_decorated(GTK_WINDOW(m_widget), false);
    m_gdkFunc = 0;
    if (style & wxRESIZE_BORDER)
       m_gdkFunc = GDK_FUNC_RESIZE;
    gtk_window_set_default_size(GTK_WINDOW(m_widget), m_width, m_height);
    memset(&m_decorSize, 0, sizeof(m_decorSize));
    m_deferShow = false;

    if (m_parent && (GTK_IS_WINDOW(m_parent->m_widget)))
    {
        gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(m_parent->m_widget) );
    }

    if (m_miniTitle && (style & wxCLOSE_BOX))
    {
        m_closeButton = wxBitmap((const char*)close_bits, 16, 16);
        m_closeButton.SetMask(new wxMask(m_closeButton));
    }

    /* these are called when the borders are drawn */
#ifdef __WXGTK3__
    g_signal_connect_after(eventbox, "draw", G_CALLBACK(draw), this);
#else
    g_signal_connect_after(eventbox, "expose_event", G_CALLBACK(expose_event), this);
#endif

    /* these are required for dragging the mini frame around */
    g_signal_connect (eventbox, "button_press_event",
                      G_CALLBACK (gtk_window_button_press_callback), this);
    g_signal_connect (eventbox, "button_release_event",
                      G_CALLBACK (gtk_window_button_release_callback), this);
    g_signal_connect (eventbox, "motion_notify_event",
                      G_CALLBACK (gtk_window_motion_notify_callback), this);
    g_signal_connect (eventbox, "leave_notify_event",
                      G_CALLBACK (gtk_window_leave_callback), this);
    return true;
}
Esempio n. 23
0
// App
bool MultiMC::OnInit()
{
#if __WXGTK__ || defined MSVC
	// Only works with Linux GCC or MSVC
	wxHandleFatalExceptions();
#endif
	exitAction = EXIT_NORMAL;
	startMode = START_NORMAL;
	updateQuiet = false;
	useProvidedDir = false;

	// This is necessary for the update system since it calls OnInitCmdLine
	// to set up the command line arguments that the update system uses.
	if (!wxApp::OnInit())
		return false;

#if OSX
	{
		wxFileName mmcDir = wxFileName::DirName(wxStandardPaths::Get().GetResourcesDir());
		mmcDir.Normalize();

		if (!mmcDir.DirExists())
			mmcDir.Mkdir(0777, wxPATH_MKDIR_FULL);

		wxSetWorkingDirectory(mmcDir.GetFullPath());
	}
#else
	if (!useProvidedDir)
	{
		wxFileName mmcDir (wxStandardPaths::Get().GetExecutablePath());
		wxSetWorkingDirectory(mmcDir.GetPath());
	}
	else
	{
		// do use provided directory
		wxSetWorkingDirectory(providedDir.GetFullPath());
	}
#endif

	if (!InitAppSettings())
	{
		wxLogError(_("Failed to initialize settings."));
		return false;
	}

	SetAppName(_("MultiMC"));
	InstallLangFiles();
	localeHelper.UpdateLangList();

	// Load language.
	long langID = wxLANGUAGE_UNKNOWN;
	if (settings->GetUseSystemLang())
		langID = wxLocale::GetSystemLanguage();
	else
		langID = settings->GetLanguageID();
	langID = localeHelper.FindClosestMatch(langID);

	// If no matching language is found, use English.
	if (langID == wxLANGUAGE_UNKNOWN)
	{
		langID = wxLANGUAGE_ENGLISH_US;
	}

	if (!localeHelper.SetLanguage((wxLanguage)langID))
	{
		localeHelper.SetLanguage(wxLANGUAGE_ENGLISH_US);
		wxLogError(_("Failed to set language. Language set to English."));
	}
	
	wxString cwd = wxGetCwd();
	if(cwd.Contains("!"))
	{
		wxLogError(_("MultiMC has been started from a path that contains '!':\n%s\nThis would break Minecraft. Please move it to a different place."), cwd.c_str());
		return false;
	}

	wxInitAllImageHandlers();
	wxSocketBase::Initialize();
	
	wxMemoryInputStream iconInput16(multimc16, sizeof(multimc16));
	wxMemoryInputStream iconInput32(multimc32, sizeof(multimc32));
	wxMemoryInputStream iconInput64(multimc64, sizeof(multimc64));
	wxMemoryInputStream iconInput128(multimc128, sizeof(multimc128));
	wxIcon icon16,icon32,icon64,icon128;
	icon16.CopyFromBitmap(wxBitmap(wxImage(iconInput16)));
	icon32.CopyFromBitmap(wxBitmap(wxImage(iconInput32)));
	icon64.CopyFromBitmap(wxBitmap(wxImage(iconInput64)));
	icon128.CopyFromBitmap(wxBitmap(wxImage(iconInput128)));
	AppIcons.AddIcon(icon16);
	AppIcons.AddIcon(icon32);
	AppIcons.AddIcon(icon64);
	AppIcons.AddIcon(icon128);
	
	wxFileSystem::AddHandler(new wxArchiveFSHandler);
	// 	wxFileSystem::AddHandler(new wxMemoryFSHandler);
	
	if (!settings->GetInstDir().DirExists())
		settings->GetInstDir().Mkdir();
	if (!settings->GetModsDir().DirExists())
		settings->GetModsDir().Mkdir();
	
	switch (startMode)
	{
	case START_NORMAL:
		{
			MainWindow *mainWin = new MainWindow();
			mainWin->SetName(wxT("MainWindow"));
			if (!wxPersistenceManager::Get().RegisterAndRestore(mainWin))
			{
				mainWin->CenterOnScreen();
			}
			mainWin->Show();
			mainWin->OnStartup();
			return true;
		}

	case START_LAUNCH_INSTANCE:
		{
			MainWindow *mainWin = new MainWindow();
			mainWin->SetName(wxT("MainWindow"));
			if (!wxPersistenceManager::Get().RegisterAndRestore(mainWin))
			{
				mainWin->CenterOnScreen();
			}
			mainWin->launchInstance = launchInstance;
			mainWin->OnStartup();
			mainWin->Hide();
			return true;
		}

	case START_INSTALL_UPDATE:
		InstallUpdate();
		return false;
	}

	return false;
}
Esempio n. 24
0
void mmAssetDialog::CreateControls()
{
    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
    this->SetSizer(itemBoxSizer2);

    wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
    itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);

    wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(this, wxID_ANY, _("Asset Details"));
    wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static
        , wxVERTICAL);
    itemBoxSizer3->Add(itemStaticBoxSizer4, g_flags);

    wxPanel* itemPanel5 = new wxPanel( this, wxID_STATIC, wxDefaultPosition
        , wxDefaultSize, wxTAB_TRAVERSAL );
    itemStaticBoxSizer4->Add(itemPanel5, g_flags);

    wxFlexGridSizer* itemFlexGridSizer6 = new wxFlexGridSizer(0, 2, 0, 0);
    itemPanel5->SetSizer(itemFlexGridSizer6);

    wxStaticText* n = new wxStaticText(itemPanel5, wxID_STATIC, _("Name"));
    itemFlexGridSizer6->Add(n, g_flags);
    n->SetFont(this->GetFont().Bold());

    m_assetName = new mmTextCtrl(itemPanel5, wxID_ANY, wxGetEmptyString());
    m_assetName->SetToolTip(_("Enter the name of the asset"));
    itemFlexGridSizer6->Add(m_assetName, g_flagsExpand);

    itemFlexGridSizer6->Add(new wxStaticText(itemPanel5, wxID_STATIC, _("Date")), g_flags);

    m_dpc = new wxDatePickerCtrl( itemPanel5, wxID_ANY, wxDefaultDateTime,
              wxDefaultPosition, wxSize(150, -1), wxDP_DROPDOWN|wxDP_SHOWCENTURY);
    itemFlexGridSizer6->Add(m_dpc, g_flags);
    m_dpc->SetToolTip(_("Specify the date of purchase of asset"));

    itemFlexGridSizer6->Add(new wxStaticText(itemPanel5, wxID_STATIC, _("Asset Type")), g_flags);

    m_assetType = new wxChoice(itemPanel5, wxID_STATIC, wxDefaultPosition, wxSize(150, -1));
    for (const auto& a : Model_Asset::all_type())
        m_assetType->Append(wxGetTranslation(a), new wxStringClientData(a));

    m_assetType->SetToolTip(_("Select type of asset"));
    m_assetType->SetSelection(Model_Asset::TYPE_PROPERTY);
    itemFlexGridSizer6->Add(m_assetType, 0,
        wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxStaticText* v = new wxStaticText(itemPanel5, wxID_STATIC, _("Value"));
    itemFlexGridSizer6->Add(v, g_flags);
    v->SetFont(this->GetFont().Bold());

    m_value = new mmTextCtrl(itemPanel5, IDC_VALUE, wxGetEmptyString()
        , wxDefaultPosition, wxSize(150,-1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER
        , mmCalcValidator() );
    m_value->SetToolTip(_("Enter the current value of the asset"));
    itemFlexGridSizer6->Add(m_value, g_flags);
    m_value->Connect(IDC_VALUE, wxEVT_COMMAND_TEXT_ENTER
        , wxCommandEventHandler(mmAssetDialog::onTextEntered), nullptr, this);

    itemFlexGridSizer6->Add(new wxStaticText(itemPanel5, wxID_STATIC, _("Change in Value")), g_flags);

    m_valueChange = new wxChoice(itemPanel5, IDC_COMBO_TYPE, wxDefaultPosition, wxSize(150, -1));
    for(const auto& a : Model_Asset::all_rate())
        m_valueChange->Append(wxGetTranslation(a));

    m_valueChange->SetToolTip(_("Specify if the value of the asset changes over time"));
    m_valueChange->SetSelection(Model_Asset::RATE_NONE);
    itemFlexGridSizer6->Add(m_valueChange, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    m_valueChangeRateLabel = new wxStaticText( itemPanel5, wxID_STATIC, _("% Rate"));
    itemFlexGridSizer6->Add(m_valueChangeRateLabel, g_flags);

    m_valueChangeRate = new mmTextCtrl(itemPanel5, IDC_RATE, wxGetEmptyString()
        , wxDefaultPosition, wxSize(150,-1), wxALIGN_RIGHT|wxTE_PROCESS_ENTER
        , mmCalcValidator());
    m_valueChangeRate->SetToolTip(_("Enter the rate at which the asset changes its value in % per year"));
    itemFlexGridSizer6->Add(m_valueChangeRate, g_flags);
    m_valueChangeRate->Connect(IDC_RATE, IDC_RATE
        , wxCommandEventHandler(mmAssetDialog::onTextEntered), nullptr, this);
    enableDisableRate(false);

    itemFlexGridSizer6->Add(new wxStaticText( itemPanel5, wxID_STATIC, _("Notes")), g_flags);

	bAttachments_ = new wxBitmapButton(itemPanel5, wxID_FILE
		, wxBitmap(attachment_xpm), wxDefaultPosition
		, wxSize(m_valueChange->GetSize().GetY(), m_valueChange->GetSize().GetY()));
	itemFlexGridSizer6->Add(bAttachments_, wxSizerFlags(g_flags).Align(wxALIGN_RIGHT));
	bAttachments_->SetToolTip(_("Organize attachments of this asset"));

    m_notes = new mmTextCtrl(this, IDC_NOTES, wxGetEmptyString(), wxDefaultPosition, wxSize(220, 170), wxTE_MULTILINE);
    m_notes->SetToolTip(_("Enter notes associated with this asset"));
    itemStaticBoxSizer4->Add(m_notes, 0, wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 10);

    wxPanel* itemPanel27 = new wxPanel(this, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
    itemBoxSizer3->Add(itemPanel27, wxSizerFlags(g_flags).Center());

    wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL);
    itemPanel27->SetSizer(itemBoxSizer28);

    wxButton* itemButton29 = new wxButton(itemPanel27, wxID_OK, _("&OK "));
    itemBoxSizer28->Add(itemButton29, g_flags);

    wxButton* itemButton30 = new wxButton(itemPanel27, wxID_CANCEL, _("&Cancel "));
    itemBoxSizer28->Add(itemButton30, g_flags);
    itemButton30->SetFocus();
}
Esempio n. 25
0
void ControlToolBar::MakeButtons()
{
   wxImage *upOriginal = new wxImage(wxBitmap(UpButton).ConvertToImage());
   wxImage *downOriginal = new wxImage(wxBitmap(DownButton).ConvertToImage());
   wxImage *hiliteOriginal = new wxImage(wxBitmap(HiliteButton).ConvertToImage());

   wxColour newColour =
       wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);

#ifdef __WXMAC__
   upPattern = upOriginal;
   downPattern = downOriginal;
   hilitePattern = hiliteOriginal;
#else
   upPattern = ChangeImageColour(upOriginal, newColour);
   downPattern = ChangeImageColour(downOriginal, newColour);
   hilitePattern = ChangeImageColour(hiliteOriginal, newColour);
#endif

   /* Buttons */
   #if (AUDACITY_BRANDING == BRAND_THINKLABS) // || (AUDACITY_BRANDING == BRAND_AUDIOTOUCH)
      #define kNumButtons 7
   #else
      #define kNumButtons 6
   #endif
   int buttonOrder[kNumButtons];
   mButtonPos = kButtonsXOffset;
   #if (AUDACITY_BRANDING != BRAND_THINKLABS)
      // no tools for Thinklabs
      if (mShowTools)
         mButtonPos += kToolsClusterWidth;
   #endif
   
   gPrefs->Read("/GUI/ErgonomicTransportButtons", &mErgonomicTransportButtons, false);

   if (mErgonomicTransportButtons)
   {
      #if (AUDACITY_BRANDING == BRAND_THINKLABS)
         buttonOrder[0] = ID_PAUSE_BUTTON;
         buttonOrder[1] = ID_PLAY_BUTTON;
         buttonOrder[2] = ID_LOOP_PLAY_BUTTON;
         buttonOrder[3] = ID_STOP_BUTTON;
         buttonOrder[4] = ID_REW_BUTTON;
         buttonOrder[5] = ID_FF_BUTTON;
         buttonOrder[6] = ID_RECORD_BUTTON;
      #elif (AUDACITY_BRANDING == BRAND_AUDIOTOUCH)
         //buttonOrder[0] = ID_LOCK_BUTTON;
         //buttonOrder[1] = ID_RECORD_BUTTON;
         //buttonOrder[2] = ID_REW_BUTTON;
         //buttonOrder[3] = ID_PLAY_BUTTON;
         //buttonOrder[4] = ID_PAUSE_BUTTON; // actually, on top of Play btn, and alternately hidden
         //buttonOrder[5] = ID_STOP_BUTTON;
         //buttonOrder[6] = ID_FF_BUTTON;

         buttonOrder[0] = ID_RECORD_BUTTON;
         buttonOrder[1] = ID_REW_BUTTON;
         buttonOrder[2] = ID_PLAY_BUTTON;
         buttonOrder[3] = ID_PAUSE_BUTTON; // actually, on top of Play btn, and alternately hidden
         buttonOrder[4] = ID_STOP_BUTTON;
         buttonOrder[5] = ID_FF_BUTTON;
      #else
         buttonOrder[0] = ID_PAUSE_BUTTON;
         buttonOrder[1] = ID_PLAY_BUTTON;
         buttonOrder[2] = ID_STOP_BUTTON;
         buttonOrder[3] = ID_REW_BUTTON;
         buttonOrder[4] = ID_FF_BUTTON;
         buttonOrder[5] = ID_RECORD_BUTTON;
      #endif
   } else
   {
      #if (AUDACITY_BRANDING == BRAND_THINKLABS)
         buttonOrder[0] = ID_REW_BUTTON;
         buttonOrder[1] = ID_PLAY_BUTTON;
         buttonOrder[2] = ID_LOOP_PLAY_BUTTON;
         buttonOrder[3] = ID_RECORD_BUTTON;
         buttonOrder[4] = ID_PAUSE_BUTTON;
         buttonOrder[5] = ID_STOP_BUTTON;
         buttonOrder[6] = ID_FF_BUTTON;
      #elif (AUDACITY_BRANDING == BRAND_AUDIOTOUCH) // ignores mErgonomicTransportButtons
         //buttonOrder[0] = ID_LOCK_BUTTON;
         //buttonOrder[1] = ID_RECORD_BUTTON;
         //buttonOrder[2] = ID_REW_BUTTON;
         //buttonOrder[3] = ID_PLAY_BUTTON;
         //buttonOrder[4] = ID_PAUSE_BUTTON; // actually, on top of Play btn, and alternately hidden
         //buttonOrder[5] = ID_STOP_BUTTON;
         //buttonOrder[6] = ID_FF_BUTTON;

         buttonOrder[0] = ID_RECORD_BUTTON;
         buttonOrder[1] = ID_REW_BUTTON;
         buttonOrder[2] = ID_PLAY_BUTTON;
         buttonOrder[3] = ID_PAUSE_BUTTON; // actually, on top of Play btn, and alternately hidden
         buttonOrder[4] = ID_STOP_BUTTON;
         buttonOrder[5] = ID_FF_BUTTON;
      #else
         buttonOrder[0] = ID_REW_BUTTON;
         buttonOrder[1] = ID_PLAY_BUTTON;
         buttonOrder[2] = ID_RECORD_BUTTON;
         buttonOrder[3] = ID_PAUSE_BUTTON;
         buttonOrder[4] = ID_STOP_BUTTON;
         buttonOrder[5] = ID_FF_BUTTON;
      #endif
   }
   
   for (int iButton = 0; iButton < kNumButtons; iButton++)
   {
      switch (buttonOrder[iButton])
      {
      case ID_REW_BUTTON:
         mRewind = MakeButton((char const **) Rewind,
                              (char const **) RewindDisabled,
                              (char const **) RewindAlpha, ID_REW_BUTTON,
                              false);
         break;
      
      case ID_PLAY_BUTTON:
         mPlay = MakeButton((char const **) Play,
                            (char const **) PlayDisabled,
                            (char const **) PlayAlpha, ID_PLAY_BUTTON,
                            false);
         MakeLoopImage();
         break;
      
      #if (AUDACITY_BRANDING == BRAND_THINKLABS)
         case ID_LOOP_PLAY_BUTTON:
            mLoopPlay = MakeButton((char const **) Loop,
                                    (char const **) LoopDisabled,
                                    (char const **) LoopAlpha, ID_LOOP_PLAY_BUTTON,
                                    false);
            break;
      //#elif (AUDACITY_BRANDING == BRAND_AUDIOTOUCH) 
      //   case ID_LOCK_BUTTON:
      //      mLock = MakeButton((char const **) Lock, 
      //                           (char const **) LockDisabled, 
      //                           (char const **) LockAlpha, ID_LOCK_BUTTON, 
      //                           true); // processDownEvents
      //      //v alt images for unlocked? Currently just making it toggle up/down with processDownEvents.
      //      break;
      #endif

      case ID_RECORD_BUTTON:
         if (mErgonomicTransportButtons)
            mButtonPos += 10; // space before record button
         
         mRecord = MakeButton((char const **) Record,
                              (char const **) RecordDisabled,
                              (char const **) RecordAlpha, ID_RECORD_BUTTON,
                              false);
         break;
      
      #if (AUDACITY_BRANDING == BRAND_AUDIOTOUCH) 
         // Audacity_Audiotouch swaps colors for Pause and Stop. 
         case ID_PAUSE_BUTTON:
            mPause = MakeButton((char const **)Pause_yellow,
                              (char const **) PauseDisabled_yellow,
                              (char const **) PauseAlpha, ID_PAUSE_BUTTON,
                              true);
            break;
         
         case ID_STOP_BUTTON:
            mStop = MakeButton((char const **) Stop_blue,
                              (char const **) StopDisabled_blue,
                              (char const **) StopAlpha, ID_STOP_BUTTON,
                              false);
            break;
      #else
         case ID_PAUSE_BUTTON:
            mPause = MakeButton((char const **)Pause,
                              (char const **) PauseDisabled,
                              (char const **) PauseAlpha, ID_PAUSE_BUTTON,
                              true);
            break;
         
         case ID_STOP_BUTTON:
            mStop = MakeButton((char const **) Stop,
                              (char const **) StopDisabled,
                              (char const **) StopAlpha, ID_STOP_BUTTON,
                              false);
            break;
      #endif
      
      case ID_FF_BUTTON:
         mFF = MakeButton((char const **) FFwd,
                          (char const **) FFwdDisabled,
                          (char const **) FFwdAlpha, ID_FF_BUTTON,
                          false);
         break;
      
      default:
         wxASSERT(false); // unknown button id
      }
   }

   #if wxUSE_TOOLTIPS
         mRewind->SetToolTip(_("Skip to Start"));
         mPlay->SetToolTip(_("Play (Shift for loop-play)"));
         #if (AUDACITY_BRANDING == BRAND_THINKLABS)
            mLoopPlay->SetToolTip(_("Loop Play"));
         //#elif (AUDACITY_BRANDING == BRAND_AUDIOTOUCH) 
         //   mLock->SetToolTip(_("Lock/Unlock Recording"));
         #endif
         mRecord->SetToolTip(_("Record"));
         mPause->SetToolTip(_("Pause"));
         mStop->SetToolTip(_("Stop"));
         mFF->SetToolTip(_("Skip to End"));
   #endif

#ifndef __WXMAC__
   delete upPattern;
   delete downPattern;
   delete hilitePattern;
#endif

   delete upOriginal;
   delete downOriginal;
   delete hiliteOriginal;

   /* Tools */

   #if (AUDACITY_BRANDING == BRAND_THINKLABS)
      // no tools for Thinklabs
      for (unsigned int i = 0; i < numTools; i++)
         mTool[i] = NULL;
   #else
      #ifdef __WXMAC__ // different positioning
         mTool[selectTool] = MakeTool(IBeam, IBeamAlpha, ID_SELECT, 0, 0);
         mTool[zoomTool] = MakeTool(Zoom, ZoomAlpha, ID_ZOOM, 0, 26);
         mTool[envelopeTool] = MakeTool(Envelope, EnvelopeAlpha, ID_ENVELOPE, 26, 0);
         mTool[slideTool] = MakeTool(TimeShift, TimeShiftAlpha, ID_SLIDE, 26, 26);
         mTool[drawTool]  = MakeTool(Draw, DrawAlpha, ID_DRAW, 52, 0);
         mTool[multiTool] = MakeTool(Multi, MultiAlpha, ID_MULTI, 52, 26); 
      #else
         mTool[selectTool] = MakeTool(IBeam, IBeamAlpha, ID_SELECT, 0, 0);
         mTool[zoomTool] = MakeTool(Zoom, ZoomAlpha, ID_ZOOM, 0, 28);
         mTool[envelopeTool] = MakeTool(Envelope, EnvelopeAlpha, ID_ENVELOPE, 27, 0);
         mTool[slideTool] = MakeTool(TimeShift, TimeShiftAlpha, ID_SLIDE, 27, 28);
         mTool[drawTool]  = MakeTool(Draw, DrawAlpha, ID_DRAW, 54, 0);
         mTool[multiTool] = MakeTool(Multi, MultiAlpha, ID_MULTI, 54, 28); 
      #endif
   #endif

#if wxUSE_TOOLTIPS
#ifdef __WXMAC__
   wxToolTip::Enable(false);    // DM: tooltips are broken in wxMac
#else
// MB: Should make this a pref
   wxToolTip::Enable(true);     
   wxToolTip::SetDelay(1000);
#endif
#endif

   RegenerateToolsTooltips();
}
Esempio n. 26
0
wxBitmap wxRibbonToolBar::MakeDisabledBitmap(const wxBitmap& original)
{
    wxImage img(original.ConvertToImage());
    return wxBitmap(img.ConvertToGreyscale());
}
void mmBillsDepositsPanel::CreateControls()
{

    wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(itemBoxSizer9);

    /* ---------------------- */
    wxPanel* headerPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition
        , wxDefaultSize, wxNO_BORDER | wxTAB_TRAVERSAL);
    itemBoxSizer9->Add(headerPanel, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);

    wxBoxSizer* itemBoxSizerVHeader = new wxBoxSizer(wxVERTICAL);
    headerPanel->SetSizer(itemBoxSizerVHeader);

    wxStaticText* itemStaticText9 = new wxStaticText(headerPanel, wxID_ANY
        , _("Repeating Transactions"));
    itemStaticText9->SetFont(this->GetFont().Larger().Bold());
    itemBoxSizerVHeader->Add(itemStaticText9, 0, wxALL, 1);

    wxBoxSizer* itemBoxSizerHHeader2 = new wxBoxSizer(wxHORIZONTAL);
    itemBoxSizerVHeader->Add(itemBoxSizerHHeader2);

    wxBitmap itemStaticBitmap(rightarrow_xpm);
    bitmapTransFilter_ = new wxStaticBitmap(headerPanel, wxID_ANY, itemStaticBitmap);
    itemBoxSizerHHeader2->Add(bitmapTransFilter_, 0, wxALL, 1);
    bitmapTransFilter_->Connect(wxID_ANY, wxEVT_LEFT_DOWN
        , wxMouseEventHandler(mmBillsDepositsPanel::OnFilterTransactions), nullptr, this);
    bitmapTransFilter_->Connect(wxID_ANY, wxEVT_RIGHT_DOWN
        , wxMouseEventHandler(mmBillsDepositsPanel::OnFilterTransactions), nullptr, this);

    itemBoxSizerHHeader2->AddSpacer(5);
    wxStaticText* statTextTransFilter_ = new wxStaticText(headerPanel, wxID_ANY
        , _("Transaction Filter"));
    itemBoxSizerHHeader2->Add(statTextTransFilter_, 0, wxALIGN_CENTER_VERTICAL, 0);

    /* ---------------------- */
    wxSplitterWindow* itemSplitterWindowBillsDeposit = new wxSplitterWindow(this
        , wxID_ANY, wxDefaultPosition, wxSize(200, 200)
        , wxSP_3DBORDER | wxSP_3DSASH | wxNO_BORDER);

    wxSize imageSize(16, 16);
    m_imageList = new wxImageList(imageSize.GetWidth(), imageSize.GetHeight());
    m_imageList->Add(wxBitmap(wxImage(error_xpm).Scale(16, 16)));
    m_imageList->Add(wxBitmap(wxImage(rt_exec_auto_xpm).Scale(16, 16)));
    m_imageList->Add(wxBitmap(wxImage(rt_exec_user_xpm).Scale(16, 16)));
    m_imageList->Add(wxBitmap(wxImage(uparrow_xpm).Scale(16, 16)));
    m_imageList->Add(wxBitmap(wxImage(downarrow_xpm).Scale(16, 16)));

    listCtrlAccount_ = new billsDepositsListCtrl(this, itemSplitterWindowBillsDeposit);

    listCtrlAccount_->SetImageList(m_imageList, wxIMAGE_LIST_SMALL);
    for (const auto& column : ColName_)
    {
        wxListItem itemCol;
        itemCol.SetText(column.second);
        listCtrlAccount_->InsertColumn(column.first, column.second
            , (column.first == COL_DUE_DATE) || (column.first == COL_AMOUNT)
                || (column.first == COL_ID) || (column.first == COL_REPEATS)
                ?  wxLIST_FORMAT_RIGHT : wxLIST_FORMAT_LEFT);

        int col_x = Model_Setting::instance().GetIntSetting(wxString::Format("BD_COL%d_WIDTH", column.first)
            , (column.first > 0 ? wxLIST_AUTOSIZE_USEHEADER : 150));
        listCtrlAccount_->SetColumnWidth(column.first, col_x);
    }

    wxPanel* bdPanel = new wxPanel(itemSplitterWindowBillsDeposit, wxID_ANY
        , wxDefaultPosition, wxDefaultSize, wxNO_BORDER | wxTAB_TRAVERSAL);

    itemSplitterWindowBillsDeposit->SplitHorizontally(listCtrlAccount_, bdPanel);
    itemSplitterWindowBillsDeposit->SetMinimumPaneSize(100);
    itemSplitterWindowBillsDeposit->SetSashGravity(1.0);
    itemBoxSizer9->Add(itemSplitterWindowBillsDeposit, 1, wxGROW | wxALL, 1);

    wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
    bdPanel->SetSizer(itemBoxSizer4);

    wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
    itemBoxSizer4->Add(itemBoxSizer5, g_flags);

    wxButton* itemButtonNew = new wxButton(bdPanel, wxID_NEW, _("&New "));
    itemButtonNew->SetToolTip(_("New Bills & Deposit Series"));
    itemBoxSizer5->Add(itemButtonNew, g_flags);

    wxButton* itemButton81 = new wxButton(bdPanel, wxID_EDIT, _("&Edit "));
    itemButton81->SetToolTip(_("Edit Bills & Deposit Series"));
    itemBoxSizer5->Add(itemButton81, g_flags);
    itemButton81->Enable(false);

    wxButton* itemButton7 = new wxButton(bdPanel, wxID_DELETE, _("&Delete "));
    itemButton7->SetToolTip(_("Delete Bills & Deposit Series"));
    itemBoxSizer5->Add(itemButton7, g_flags);
    itemButton7->Enable(false);

    wxButton* itemButton8 = new wxButton(bdPanel, wxID_PASTE, _("En&ter"));
    itemButton8->SetToolTip(_("Enter Next Bills & Deposit Occurrence"));
    itemBoxSizer5->Add(itemButton8, g_flags);
    itemButton8->Enable(false);

    wxButton* buttonSkipTrans = new wxButton(bdPanel, wxID_IGNORE, _("&Skip"));
    buttonSkipTrans->SetToolTip(_("Skip Next Bills & Deposit Occurrence"));
    itemBoxSizer5->Add(buttonSkipTrans, g_flags);
    buttonSkipTrans->Enable(false);

    wxBitmapButton* btnAttachment_ = new wxBitmapButton(bdPanel, wxID_FILE
        , wxBitmap(attachment_xpm), wxDefaultPosition
        , wxSize(30, itemButton8->GetSize().GetY()));
    btnAttachment_->SetToolTip(_("Open attachments"));
    itemBoxSizer5->Add(btnAttachment_, g_flags);
    btnAttachment_->Enable(false);

    //Infobar-mini
    m_infoTextMini = new wxStaticText(bdPanel, wxID_STATIC, "");
    itemBoxSizer5->Add(m_infoTextMini, 1, wxGROW | wxTOP, 12);

    //Infobar
    m_infoText = new wxStaticText(bdPanel, wxID_ANY, ""
        , wxPoint(-1, -1), wxSize(200, -1), wxNO_BORDER | wxTE_MULTILINE | wxTE_WORDWRAP | wxST_NO_AUTORESIZE);
    itemBoxSizer4->Add(m_infoText, 1, wxGROW | wxLEFT | wxRIGHT, 14);

    mmBillsDepositsPanel::updateBottomPanelData(-1);
}
Esempio n. 28
0
FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
                           const wxString & title,
                           const wxPoint & pos)
:  wxDialogWrapper(parent, id, title, pos, wxDefaultSize,
            wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX),
   mData(NULL),
   mAnalyst(std::make_unique<SpectrumAnalyst>())
{
   SetName(GetTitle());

   mMouseX = 0;
   mMouseY = 0;
   mRate = 0;
   mDataLen = 0;

   p = GetActiveProject();
   if (!p)
      return;

   wxArrayString algChoices;
   algChoices.Add(_("Spectrum"));
   algChoices.Add(_("Standard Autocorrelation"));
   algChoices.Add(_("Cuberoot Autocorrelation"));
   algChoices.Add(_("Enhanced Autocorrelation"));
     /* i18n-hint: This is a technical term, derived from the word
      * "spectrum".  Do not translate it unless you are sure you
      * know the correct technical word in your language. */
   algChoices.Add(_("Cepstrum"));

   wxArrayString sizeChoices;
   sizeChoices.Add(wxT("128"));
   sizeChoices.Add(wxT("256"));
   sizeChoices.Add(wxT("512"));
   sizeChoices.Add(wxT("1024"));
   sizeChoices.Add(wxT("2048"));
   sizeChoices.Add(wxT("4096"));
   sizeChoices.Add(wxT("8192"));
   sizeChoices.Add(wxT("16384"));
   sizeChoices.Add(wxT("32768"));
   sizeChoices.Add(wxT("65536"));

   wxArrayString funcChoices;
   for (int i = 0, cnt = NumWindowFuncs(); i < cnt; i++)
   {
      /* i18n-hint: This refers to a "window function", used in the
       * Frequency analyze dialog box. */
      funcChoices.Add(wxString(WindowFuncName(i)) + wxT(" ") + _("window"));
   }

   wxArrayString axisChoices;
   axisChoices.Add(_("Linear frequency"));
   axisChoices.Add(_("Log frequency"));

   mFreqFont = wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
   mArrowCursor = std::make_unique<wxCursor>(wxCURSOR_ARROW);
   mCrossCursor = std::make_unique<wxCursor>(wxCURSOR_CROSS);

   gPrefs->Read(wxT("/FreqWindow/DrawGrid"), &mDrawGrid, true);

   long size;
   gPrefs->Read(wxT("/FreqWindow/SizeChoice"), &mSize, 3);
   sizeChoices[mSize].ToLong(&size);
   mWindowSize = size;

   int alg;
   gPrefs->Read(wxT("/FreqWindow/AlgChoice"), &alg, 0);
   mAlg = static_cast<SpectrumAnalyst::Algorithm>(alg);

   gPrefs->Read(wxT("/FreqWindow/FuncChoice"), &mFunc, 3);
   gPrefs->Read(wxT("/FreqWindow/AxisChoice"), &mAxis, 1);
   gPrefs->Read(ENV_DB_KEY, &dBRange, ENV_DB_RANGE);
   if(dBRange < 90.)
      dBRange = 90.;

   ShuttleGui S(this, eIsCreating);

   S.SetBorder(0);

   S.AddSpace(5);

   S.SetSizerProportion(1);
   S.StartMultiColumn(3, wxEXPAND);
   {
      S.SetStretchyCol(1);
      S.SetStretchyRow(0);

      // -------------------------------------------------------------------
      // ROW 1: Freq response panel and sliders for vertical scale
      // -------------------------------------------------------------------

      S.StartVerticalLay(2);
      {
         vRuler = safenew RulerPanel(this, wxID_ANY);
         vRuler->ruler.SetBounds(0, 0, 100, 100); // Ruler can't handle small sizes
         vRuler->ruler.SetOrientation(wxVERTICAL);
         vRuler->ruler.SetRange(0.0, -dBRange);
         vRuler->ruler.SetFormat(Ruler::LinearDBFormat);
         vRuler->ruler.SetUnits(_("dB"));
         vRuler->ruler.SetLabelEdges(true);
         int w;
         vRuler->ruler.GetMaxSize(&w, NULL);
         vRuler->SetMinSize(wxSize(w, 150));  // height needed for wxGTK

         S.AddSpace(wxDefaultCoord, 1);
         S.Prop(1);
         S.AddWindow(vRuler, wxALIGN_RIGHT | wxALIGN_TOP);
         S.AddSpace(wxDefaultCoord, 1);
      }
      S.EndVerticalLay();

      mFreqPlot = safenew FreqPlot(this);
      mFreqPlot->SetMinSize(wxSize(wxDefaultCoord, FREQ_WINDOW_HEIGHT));
      S.Prop(1);
      S.AddWindow(mFreqPlot, wxEXPAND);

      S.StartHorizontalLay(wxEXPAND, 0);
      {
         S.StartVerticalLay();
         {
            mPanScroller = safenew wxScrollBar(this, FreqPanScrollerID,
               wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL);
            mPanScroller->SetName(_("Scroll"));
            S.Prop(1);
            S.AddWindow(mPanScroller, wxALIGN_LEFT | wxTOP);
         }
         S.EndVerticalLay();

         S.StartVerticalLay();
         {
            wxStaticBitmap *zi = safenew wxStaticBitmap(this, wxID_ANY, wxBitmap(ZoomIn));
            S.AddWindow((wxWindow *) zi, wxALIGN_CENTER);

            S.AddSpace(5);

            mZoomSlider = safenew wxSlider(this, FreqZoomSliderID, 100, 1, 100,
               wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL);
            S.Prop(1);
            S.AddWindow(mZoomSlider, wxALIGN_CENTER_HORIZONTAL);
            mZoomSlider->SetName(_("Zoom"));

            S.AddSpace(5);

            wxStaticBitmap *zo = safenew wxStaticBitmap(this, wxID_ANY, wxBitmap(ZoomOut));
            S.AddWindow((wxWindow *) zo, wxALIGN_CENTER);
         }
         S.EndVerticalLay();

         S.AddSpace(5, wxDefaultCoord);
      }
      S.EndHorizontalLay();

      // -------------------------------------------------------------------
      // ROW 2: Frequency ruler
      // -------------------------------------------------------------------

      S.AddSpace(1);

      S.StartHorizontalLay(wxEXPAND, 0);
      {
         hRuler  = safenew RulerPanel(this, wxID_ANY);
         hRuler->ruler.SetBounds(0, 0, 100, 100); // Ruler can't handle small sizes
         hRuler->ruler.SetOrientation(wxHORIZONTAL);
         hRuler->ruler.SetLog(true);
         hRuler->ruler.SetRange(10, 20000);
         hRuler->ruler.SetFormat(Ruler::RealFormat);
         hRuler->ruler.SetUnits(wxT("Hz"));
         hRuler->ruler.SetFlip(true);
         hRuler->ruler.SetLabelEdges(true);
         int h;
         hRuler->ruler.GetMaxSize(NULL, &h);
         hRuler->SetMinSize(wxSize(wxDefaultCoord, h));

         S.AddSpace(1, wxDefaultCoord);
         S.Prop(1);
         S.AddWindow(hRuler, wxALIGN_LEFT | wxALIGN_TOP);
         S.AddSpace(1, wxDefaultCoord);
      }
      S.EndHorizontalLay();

      S.AddSpace(1);

      // -------------------------------------------------------------------
      // ROW 3: Spacer
      // -------------------------------------------------------------------
      S.AddSpace(5);
      S.AddSpace(5);
      S.AddSpace(5);

      // -------------------------------------------------------------------
      // ROW 4: Info
      // -------------------------------------------------------------------

      S.AddSpace(1);

      S.StartHorizontalLay(wxEXPAND);
      {
         S.SetSizerProportion(1);
         S.StartMultiColumn(4);
         S.SetStretchyCol(1);
         S.SetStretchyCol(3);
         {
            S.AddPrompt(wxT("Cursor:"));

            S.SetStyle(wxTE_READONLY);
            mCursorText = S.AddTextBox(wxT(""), wxT(""), 10);

            S.AddPrompt(wxT("Peak:"));

            S.SetStyle(wxTE_READONLY);
            mPeakText = S.AddTextBox(wxT(""), wxT(""), 10);
         }
         S.EndMultiColumn();
      }
      S.EndHorizontalLay();

      S.AddSpace(1);
   }
   S.EndMultiColumn();

   // -------------------------------------------------------------------
   // ROW 5: Spacer
   // -------------------------------------------------------------------
   
   S.AddSpace(5);

   S.SetBorder(2);
   S.SetSizerProportion(0);
   S.StartMultiColumn(11, wxALIGN_CENTER);
   {
      // ----------------------------------------------------------------
      // ROW 6: Algorithm, Size, Export, Replot
      // ----------------------------------------------------------------

      S.AddSpace(5);

      mAlgChoice = S.Id(FreqAlgChoiceID).AddChoice(_("&Algorithm:"), wxT(""), &algChoices);
      mAlgChoice->SetSelection(mAlg);
      S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);

      S.AddSpace(5);

      mSizeChoice = S.Id(FreqSizeChoiceID).AddChoice(_("&Size:"), wxT(""), &sizeChoices);
      mSizeChoice->SetSelection(mSize);
      S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);

      S.AddSpace(5);

      mExportButton = S.Id(FreqExportButtonID).AddButton(_("&Export..."));

      S.AddSpace(5);

      mReplotButton = S.Id(ReplotButtonID).AddButton(_("&Replot..."));

      S.AddSpace(5);

      // ----------------------------------------------------------------
      // ROW 7: Function, Axix, Grids, Close
      // ----------------------------------------------------------------

      S.AddSpace(5);

      mFuncChoice = S.Id(FreqFuncChoiceID).AddChoice(_("&Function:"), wxT(""), &funcChoices);
      mFuncChoice->SetSelection(mFunc);
      S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);
      mFuncChoice->MoveAfterInTabOrder(mSizeChoice);

      S.AddSpace(5);

      mAxisChoice = S.Id(FreqAxisChoiceID).AddChoice(_("&Axis:"), wxT(""), &axisChoices);
      mAxisChoice->SetSelection(mAxis);
      S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);
      mAxisChoice->MoveAfterInTabOrder(mFuncChoice);

      S.AddSpace(5);

      mGridOnOff = S.Id(GridOnOffID).AddCheckBox(_("&Grids"), wxT("false"));
      mGridOnOff->SetValue(mDrawGrid);

      S.AddSpace(5);

      mCloseButton = S.Id(wxID_CANCEL).AddButton(_("&Close"));

      S.AddSpace(5);
   }
   S.EndMultiColumn();

   // -------------------------------------------------------------------
   // ROW 8: Spacer
   // -------------------------------------------------------------------

   S.AddSpace(5);

   mProgress = safenew FreqGauge(this); //, wxID_ANY, wxST_SIZEGRIP);
   S.AddWindow(mProgress, wxEXPAND);

   // Log-frequency axis works for spectrum plots only.
   if (mAlg != SpectrumAnalyst::Spectrum)
   {
      mAxis = 0;
      mAxisChoice->Disable();
   }
   mLogAxis = mAxis != 0;

   mCloseButton->SetDefault();
   mCloseButton->SetFocus();

   Layout();
   Fit();
   SetMinSize(GetSize());
   mAlgChoice->SetFocus();

#if defined(__WXGTK__)
   // This should be rechecked with wx3.
   //
   // The scrollbar (focus some reason) doesn't allow tabbing past it
   // because it can't receive focus.  So, convince it otherwise.
   //
   // Unfortunately, this still doesn't let you adjust the scrollbar
   // from the keyboard.  Near as I can tell, wxWGTK is capturing the
   // keyboard input, so the GTK widget doesn't see it, preventing
   // the normal scroll events from being generated.
   //
   // I guess the only way round it would be to handle key actions
   // ourselves, but we'll leave that for a future date.
//   gtk_widget_set_can_focus(mPanScroller->m_widget, true);
#endif
}
Esempio n. 29
0
void mmBudgetingPanel::CreateControls()
{
    wxSizerFlags flags;
    flags.Align(wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL).Border(wxLEFT|wxTOP, 4);

    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(itemBoxSizer2);

    wxPanel* itemPanel3 = new wxPanel(this, ID_PANEL_REPORTS_HEADER_PANEL
        , wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
    itemBoxSizer2->Add(itemPanel3, flags);

    wxBoxSizer* itemBoxSizerVHeader = new wxBoxSizer(wxVERTICAL);
    itemPanel3->SetSizer(itemBoxSizerVHeader);

    budgetReportHeading_ = new wxStaticText(itemPanel3, wxID_ANY, "");

    budgetReportHeading_->SetFont(this->GetFont().Larger().Bold());

    wxBoxSizer* budgetReportHeadingSizer = new wxBoxSizer(wxHORIZONTAL);
    budgetReportHeadingSizer->Add(budgetReportHeading_, 1);
    itemBoxSizerVHeader->Add(budgetReportHeadingSizer, 0, wxALL, 1);

    wxBoxSizer* itemBoxSizerHHeader2 = new wxBoxSizer(wxHORIZONTAL);
    itemBoxSizerVHeader->Add(itemBoxSizerHHeader2, 0, wxALL, 1);

    wxBitmap itemStaticBitmap3Bitmap(wxBitmap(wxImage(rightarrow_xpm).Scale(16,16)));
    wxStaticBitmap* itemStaticBitmap3 = new wxStaticBitmap(itemPanel3
        , ID_PANEL_BUDGETENTRY_STATIC_BITMAP_VIEW
        , itemStaticBitmap3Bitmap, wxDefaultPosition, wxSize(16, 16), 0);
    itemStaticBitmap3->Connect(ID_PANEL_BUDGETENTRY_STATIC_BITMAP_VIEW, wxEVT_LEFT_DOWN
        , wxMouseEventHandler(mmBudgetingPanel::OnMouseLeftDown), nullptr, this);
    itemBoxSizerHHeader2->Add(itemStaticBitmap3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);

    wxStaticText* itemStaticText18 = new wxStaticText(itemPanel3
        , ID_PANEL_CHECKING_STATIC_PANELVIEW, "");
    itemBoxSizerHHeader2->Add(itemStaticText18, 0, wxALL, 1);

    wxFlexGridSizer* itemIncomeSizer = new wxFlexGridSizer(0, 7, 5, 10);
    itemBoxSizerVHeader->Add(itemIncomeSizer);

    income_estimated_ = new wxStaticText(itemPanel3
        , ID_DIALOG_BUDGETENTRY_SUMMARY_INCOME_EST, "$", wxDefaultPosition, wxSize(120, -1));
    income_actual_ = new wxStaticText(itemPanel3
        , ID_DIALOG_BUDGETENTRY_SUMMARY_INCOME_ACT, "$", wxDefaultPosition, wxSize(120, -1));
    income_diff_ = new wxStaticText(itemPanel3
        , ID_DIALOG_BUDGETENTRY_SUMMARY_INCOME_DIF, "$");

    expenses_estimated_ = new wxStaticText(itemPanel3
        , ID_DIALOG_BUDGETENTRY_SUMMARY_EXPENSES_EST, "$", wxDefaultPosition, wxSize(120, -1));
    expenses_actual_ = new wxStaticText(itemPanel3
        , ID_DIALOG_BUDGETENTRY_SUMMARY_EXPENSES_ACT, "$", wxDefaultPosition, wxSize(120, -1));
    expenses_diff_ = new wxStaticText(itemPanel3
        , ID_DIALOG_BUDGETENTRY_SUMMARY_EXPENSES_DIF, "$");

    itemIncomeSizer->Add(new wxStaticText(itemPanel3, wxID_STATIC, _("Income: ")));
    itemIncomeSizer->Add(new wxStaticText(itemPanel3, wxID_STATIC, _("Estimated: ")));
    itemIncomeSizer->Add(income_estimated_);
    itemIncomeSizer->Add(new wxStaticText(itemPanel3, wxID_STATIC, _("Actual: ")));
    itemIncomeSizer->Add(income_actual_);
    itemIncomeSizer->Add(new wxStaticText(itemPanel3, wxID_STATIC, _("Difference: ")));
    itemIncomeSizer->Add(income_diff_);

    itemIncomeSizer->Add(new wxStaticText(itemPanel3, wxID_STATIC, _("Expenses: ")));
    itemIncomeSizer->Add(new wxStaticText(itemPanel3, wxID_STATIC, _("Estimated: ")));
    itemIncomeSizer->Add(expenses_estimated_);
    itemIncomeSizer->Add(new wxStaticText(itemPanel3, wxID_STATIC, _("Actual: ")));
    itemIncomeSizer->Add(expenses_actual_);
    itemIncomeSizer->Add(new wxStaticText(itemPanel3, wxID_STATIC, _("Difference: ")));
    itemIncomeSizer->Add(expenses_diff_);
    /* ---------------------- */

    wxSize imageSize(16, 16);
    m_imageList = new wxImageList(imageSize.GetWidth(), imageSize.GetHeight());
    m_imageList->Add(wxBitmap(reconciled_xpm));
    m_imageList->Add(wxBitmap(void_xpm));
    m_imageList->Add(wxBitmap(flag_xpm));
    m_imageList->Add(wxBitmap(empty_xpm));

    listCtrlBudget_ = new budgetingListCtrl(this, this, wxID_ANY);

    listCtrlBudget_->SetImageList(m_imageList, wxIMAGE_LIST_SMALL);
    listCtrlBudget_->InsertColumn(COL_ICON, (" "));
    listCtrlBudget_->InsertColumn(COL_CATEGORY, std::get<0>(listCtrlBudget_->m_columns[COL_CATEGORY]));
    listCtrlBudget_->InsertColumn(COL_SUBCATEGORY, std::get<0>(listCtrlBudget_->m_columns[COL_SUBCATEGORY]));
    listCtrlBudget_->InsertColumn(COL_FREQUENCY, std::get<0>(listCtrlBudget_->m_columns[COL_FREQUENCY]));
    listCtrlBudget_->InsertColumn(COL_AMOUNT, std::get<0>(listCtrlBudget_->m_columns[COL_AMOUNT]), wxLIST_FORMAT_RIGHT);
    listCtrlBudget_->InsertColumn(COL_ESTIMATED, std::get<0>(listCtrlBudget_->m_columns[COL_ESTIMATED]), wxLIST_FORMAT_RIGHT);
    listCtrlBudget_->InsertColumn(COL_ACTUAL, std::get<0>(listCtrlBudget_->m_columns[COL_ACTUAL]), wxLIST_FORMAT_RIGHT);

    /* Get data from inidb */
    for (int i = 0; i < listCtrlBudget_->GetColumnCount(); ++i)
    {
        int col = Model_Setting::instance().GetIntSetting(wxString::Format(listCtrlBudget_->m_col_width, i), std::get<1>(listCtrlBudget_->m_columns[i]));
        listCtrlBudget_->SetColumnWidth(i, col);
    }
    itemBoxSizer2->Add(listCtrlBudget_, 1, wxGROW | wxALL, 1);
}
void GraphicsImageCanvas::OnPaint (wxPaintEvent& event)
{
	wxAlphaPixelData data (*image);
	if (!data) {
		wxLogError (wxT ("Failed to gain access to raw bitmap data"));
		event.Skip();
		return;
	}

	wxAlphaPixelData::Iterator p (data);

	p.Offset (data, 0, 0); // no offset

	// Finding the maximum
	int max = 0;
	for (int ii = 0; ii < length; ii++) {
		if (max < imageData[ii]) {
			max = imageData[ii];
		}
	}

	for (int y = 0; y < height; ++y) {
		wxAlphaPixelData::Iterator rowStart = p;

		//for (int x = 0; x < width; ++x, ++p) {
		for (int x = (width - 1); x >= 0; --x, ++p) {
			p.Red() = ( (this->imageData[ (y * width) + x]) /max) * 255;
			p.Green() = ( (this->imageData[ (y * width) + x]) /max) * 255;
			p.Blue() = ( (this->imageData[ (y * width) + x]) /max) * 255;
		}
		p = rowStart;
		p.OffsetY (data, 1);
	}

	wxBufferedPaintDC dci (this);

	// Find the image scale factor and center the image.
	double scaleW = ( (double) image->GetWidth() / (double) (GetClientSize()).GetWidth());
	double scaleH = ( (double) image->GetHeight() / (double) (GetClientSize()).GetHeight());
	double scaleImage = 1;

	if (scaleW > scaleH) {
		scaleImage = scaleW;
	} else {
		scaleImage = scaleH;
	}

	// The commented out code worked in xp but not osx
	//SetSize(width/scaleImage, height/scaleImage);
	//dci.DrawBitmap (*this->image, 0, 0, true);
	//dci.SetUserScale (scaleImage, scaleImage);
	//if (NULL != fullscreen){
	//	CentreOnParent();
	//}

	wxImage displayImage = image->ConvertToImage();

	displayImage = displayImage.Scale (displayImage.GetWidth() /scaleImage, displayImage.GetHeight() /scaleImage);

	int cw = (GetClientSize()).GetWidth();
	int ch = (GetClientSize()).GetHeight();
	int pw = ( (cw - displayImage.GetWidth()) /2);
	int ph = ( (ch - displayImage.GetHeight()) /2);
	displayImage = displayImage.Size (wxSize (cw, ch), wxPoint (pw, ph), 0, 0, 0);

	wxBitmap tmpBitmap = wxBitmap (displayImage);
	dci.DrawBitmap (tmpBitmap, 0, 0, true);
}