~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

Viewing changes to src/plugins/contrib/dragscroll/dragscrollcfg.cpp

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "configmanager.h"
 
2
#include "dragscrollcfg.h"
 
3
 
 
4
BEGIN_EVENT_TABLE(cbDragScrollCfg,cbConfigurationPanel)
 
5
//      //(*EventTable(cbDragScrollCfg)
 
6
//      EVT_BUTTON(ID_DONEBUTTON,cbDragScrollCfg::OnDoneButtonClick)
 
7
//      //*)
 
8
END_EVENT_TABLE()
 
9
 
 
10
// ----------------------------------------------------------------------------
 
11
cbDragScrollCfg::cbDragScrollCfg(wxWindow* parent, cbDragScroll* pOwner, wxWindowID /*id*/)
 
12
// ----------------------------------------------------------------------------
 
13
    :pOwnerClass(pOwner)
 
14
{
 
15
    cbConfigurationPanel::Create(parent, -1, wxDefaultPosition, wxDefaultSize,
 
16
                wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
 
17
 
 
18
        wxBoxSizer* bSizer1;
 
19
        bSizer1 = new wxBoxSizer( wxVERTICAL );
 
20
 
 
21
        wxBoxSizer* bSizer2;
 
22
        bSizer2 = new wxBoxSizer( wxVERTICAL );
 
23
 
 
24
        bSizer2->SetMinSize(wxSize( -1,50 ));
 
25
        StaticText1 = new wxStaticText( this, wxID_ANY, _("Mouse Drag Scrolling Configuration"), wxDefaultPosition, wxDefaultSize, 0 );
 
26
        bSizer2->Add( StaticText1, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
 
27
 
 
28
        bSizer2->Add( 0, 0, 1, wxEXPAND, 0 );
 
29
 
 
30
        bSizer1->Add( bSizer2, 0, wxEXPAND, 5 );
 
31
 
 
32
        wxBoxSizer* bSizer5;
 
33
        bSizer5 = new wxBoxSizer( wxHORIZONTAL );
 
34
 
 
35
        ScrollEnabled = new wxCheckBox( this, wxID_ANY, _("Scrolling Enabled"), wxDefaultPosition, wxDefaultSize, 0 );
 
36
 
 
37
        bSizer5->Add( ScrollEnabled, 0, wxALL, 5 );
 
38
 
 
39
        bSizer1->Add( bSizer5, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
 
40
 
 
41
        wxBoxSizer* bSizer6;
 
42
        bSizer6 = new wxBoxSizer( wxHORIZONTAL );
 
43
 
 
44
        EditorFocusEnabled = new wxCheckBox( this, wxID_ANY, _("Auto Focus Editors"), wxDefaultPosition, wxDefaultSize, 0 );
 
45
 
 
46
        bSizer6->Add( EditorFocusEnabled, 0, wxALL, 5 );
 
47
 
 
48
        MouseFocusEnabled = new wxCheckBox( this, wxID_ANY, _("Focus follows Mouse"), wxDefaultPosition, wxDefaultSize, 0 );
 
49
 
 
50
        bSizer6->Add( MouseFocusEnabled, 0, wxALL, 5 );
 
51
 
 
52
        bSizer1->Add( bSizer6, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
 
53
 
 
54
        wxBoxSizer* MouseWheelSizer1;
 
55
        MouseWheelSizer1 = new wxBoxSizer( wxHORIZONTAL );
 
56
        MouseWheelZoom = new wxCheckBox( this, wxID_ANY, _("Log MouseWheelZoom"), wxDefaultPosition, wxDefaultSize, 0 );
 
57
        MouseWheelSizer1->Add( MouseWheelZoom, 0, wxALL, 5 );
 
58
        PropagateLogZoomSize = new wxCheckBox( this, wxID_ANY, _("Propagate Log Zooms"), wxDefaultPosition, wxDefaultSize, 0 );
 
59
        MouseWheelSizer1->Add( PropagateLogZoomSize, 0, wxALL, 5 );
 
60
        bSizer1->Add( MouseWheelSizer1, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
 
61
 
 
62
        wxBoxSizer* bSizer3;
 
63
        bSizer3 = new wxBoxSizer( wxHORIZONTAL );
 
64
 
 
65
        wxString ScrollDirectionChoices[] = { _("With Mouse"), _("Opposite Mouse") };
 
66
        int ScrollDirectionNChoices = sizeof( ScrollDirectionChoices ) / sizeof( wxString );
 
67
        ScrollDirection = new wxRadioBox( this, wxID_ANY, _("Scroll Direction"), wxDefaultPosition, wxDefaultSize, ScrollDirectionNChoices, ScrollDirectionChoices, 2, wxRA_SPECIFY_COLS );
 
68
        bSizer3->Add( ScrollDirection, 0, wxALL, 5 );
 
69
 
 
70
        bSizer1->Add( bSizer3, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
 
71
 
 
72
        wxBoxSizer* bSizer4;
 
73
        bSizer4 = new wxBoxSizer( wxHORIZONTAL );
 
74
 
 
75
        StaticText2 = new wxStaticText( this, wxID_ANY, _("Mouse Key To Use:"), wxDefaultPosition, wxDefaultSize, 0 );
 
76
        bSizer4->Add( StaticText2, 0, wxALL, 5 );
 
77
 
 
78
        wxString MouseKeyChoiceChoices[] = { _("Right"), _("Middle") };
 
79
        int MouseKeyChoiceNChoices = sizeof( MouseKeyChoiceChoices ) / sizeof( wxString );
 
80
        MouseKeyChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, MouseKeyChoiceNChoices, MouseKeyChoiceChoices, 0 );
 
81
        bSizer4->Add( MouseKeyChoice, 0, wxALL, 5 );
 
82
 
 
83
        bSizer1->Add( bSizer4, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
 
84
 
 
85
        wxBoxSizer* bSizer7;
 
86
        bSizer7 = new wxBoxSizer( wxVERTICAL );
 
87
 
 
88
        bSizer7->SetMinSize(wxSize( 300,-1 ));
 
89
        bSizer7->Add( 0, 0, 1, wxEXPAND, 0 );
 
90
 
 
91
        StaticText3 = new wxStaticText( this, wxID_ANY, _("-- Adaptive Mouse Speed Sensitivity --"), wxDefaultPosition, wxDefaultSize, 0 );
 
92
        bSizer7->Add( StaticText3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
 
93
 
 
94
        Sensitivity = new wxSlider( this, wxID_ANY, 8, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS|wxSL_TOP );
 
95
#if wxCHECK_VERSION(2,9,0)
 
96
        if ( 1 ) Sensitivity->SetTickFreq(1);
 
97
#else
 
98
        if ( 1 ) Sensitivity->SetTickFreq(1,0);
 
99
#endif
 
100
        if ( 1 ) Sensitivity->SetPageSize(1);
 
101
        if ( 0 ) Sensitivity->SetLineSize(0);
 
102
        if ( 0 ) Sensitivity->SetThumbLength(0);
 
103
        if ( 1 ) Sensitivity->SetTick(1);
 
104
        if ( 1 ) Sensitivity->SetSelection(1,10);
 
105
        bSizer7->Add( Sensitivity, 0, wxALL|wxEXPAND, 5 );
 
106
 
 
107
        bSizer7->Add( 0, 0, 1, wxEXPAND, 0 );
 
108
 
 
109
        StaticText4 = new wxStaticText( this, wxID_ANY, _("-- Mouse Movement to Text Scroll Ratio --"), wxDefaultPosition, wxDefaultSize, 0 );
 
110
        bSizer7->Add( StaticText4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
 
111
 
 
112
        MouseToLineRatio = new wxSlider( this, wxID_ANY, 30, 10, 100, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS|wxSL_TOP );
 
113
#if wxCHECK_VERSION(2,9,0)
 
114
        if ( 1 ) MouseToLineRatio->SetTickFreq(10);
 
115
#else
 
116
        if ( 1 ) MouseToLineRatio->SetTickFreq(10,10);
 
117
#endif
 
118
        if ( 1 ) MouseToLineRatio->SetPageSize(10);
 
119
        if ( 0 ) MouseToLineRatio->SetLineSize(0);
 
120
        if ( 0 ) MouseToLineRatio->SetThumbLength(0);
 
121
        if ( 1 ) MouseToLineRatio->SetTick(10);
 
122
        if ( 1 ) MouseToLineRatio->SetSelection(10,100);
 
123
        bSizer7->Add( MouseToLineRatio, 0, wxALL|wxEXPAND, 5 );
 
124
 
 
125
        bSizer7->Add( 0, 0, 1, wxEXPAND, 0 );
 
126
 
 
127
        StaticText5 = new wxStaticText( this, wxID_ANY, _("-- Unix Context Menu Watch for Drag (millisecs) --"), wxDefaultPosition, wxDefaultSize, 0 );
 
128
        bSizer7->Add( StaticText5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
 
129
 
 
130
        MouseContextDelay = new wxSlider( this, wxID_ANY, 50, 10, 500, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS|wxSL_TOP );
 
131
        // Above values are: default mil delay, min, max
 
132
#if wxCHECK_VERSION(2,9,0)
 
133
        if ( 1 ) MouseContextDelay->SetTickFreq(10);
 
134
#else
 
135
        if ( 1 ) MouseContextDelay->SetTickFreq(10,10);
 
136
#endif
 
137
        if ( 1 ) MouseContextDelay->SetPageSize(10);
 
138
        if ( 1 ) MouseContextDelay->SetLineSize(10);
 
139
        if ( 1 ) MouseContextDelay->SetThumbLength(10);
 
140
        if ( 1 ) MouseContextDelay->SetTick(100);
 
141
        if ( 1 ) MouseContextDelay->SetSelection(10,500);
 
142
        bSizer7->Add( MouseContextDelay, 0, wxALL|wxEXPAND, 5 );
 
143
 
 
144
        bSizer7->Add( 0, 0, 1, wxEXPAND, 0 );
 
145
 
 
146
        bSizer1->Add( bSizer7, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
 
147
 
 
148
        this->SetSizer( bSizer1 );
 
149
        this->Layout();
 
150
 
 
151
}
 
152
// ----------------------------------------------------------------------------
 
153
void cbDragScrollCfg::OnApply()
 
154
// ----------------------------------------------------------------------------
 
155
{
 
156
    pOwnerClass->OnDialogDone(this);
 
157
}
 
158
// ----------------------------------------------------------------------------
 
159
cbDragScrollCfg::~cbDragScrollCfg()
 
160
// ----------------------------------------------------------------------------
 
161
{
 
162
}
 
163
// ----------------------------------------------------------------------------
 
164
void cbDragScrollCfg::OnDoneButtonClick(wxCommandEvent& /*event*/)
 
165
// ----------------------------------------------------------------------------
 
166
{
 
167
    //EndModal(0);
 
168
    #if defined(LOGGING)
 
169
    LOGIT( _T("cbDragScrollCfg::OnDoneButtonClick erroniously called") );
 
170
    #endif
 
171
}
 
172
// ----------------------------------------------------------------------------
 
173
wxString cbDragScrollCfg::GetBitmapBaseName() const
 
174
{
 
175
    //probing
 
176
    //LOGIT( _T("Config:%s"),ConfigManager::GetConfigFolder().GetData()  );
 
177
    //LOGIT( _T("Plugins:%s"),ConfigManager::GetPluginsFolder().GetData() );
 
178
    //LOGIT( _T("Data:%s"),ConfigManager::GetDataFolder().GetData() );
 
179
    //LOGIT( _T("Executable:%s"),ConfigManager::GetExecutableFolder().GetData() );
 
180
 
 
181
    wxString pngName = _T("generic-plugin");
 
182
    //if file exist "./share/codeblocks/images/settings/cbdragscroll.png";
 
183
    #ifdef __WXGTK__
 
184
     if ( ::wxFileExists(ConfigManager::GetDataFolder() + _T("/images/settings/dragscroll.png")) )
 
185
    #else
 
186
     if ( ::wxFileExists(ConfigManager::GetDataFolder() + _T("\\images\\settings\\dragscroll.png")) )
 
187
    #endif
 
188
        pngName = _T("dragscroll") ;
 
189
    // else return "generic-plugin"
 
190
    return pngName;
 
191
}
 
192
// ----------------------------------------------------------------------------
 
193
//