File: window_main_burst.h

package info (click to toggle)
pdfchain 1:0.4.4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,352 kB
  • sloc: cpp: 4,861; sh: 1,352; makefile: 432
file content (205 lines) | stat: -rw-r--r-- 4,434 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*
 * window_main_burst.h
 * Copyright (C) Martin Singer 2009-2013 <m_power3@users.sourceforge.net>
 * 
 * pdfchain is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * pdfchain is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __PDFCHAIN_WINDOW_MAIN_BURST_H__
#define __PDFCHAIN_WINDOW_MAIN_BURST_H__

#include "pdfchain.h"
#include "store.h"
#include "dialog_filechooser.h"


/*** Combobox : Counting Base **********************************************/

class
cCBox_CountingBase : public Gtk::ComboBox
{
	friend class cSection_Burst;
	
	public:

		// Constructor
		         cCBox_CountingBase();
		virtual ~cCBox_CountingBase();
		
	protected:

		// Anchors
		Glib::RefPtr<cLStore_CountingBase> rLStore;
		Gtk::CellRendererText mCRText;
		cTMCRecord_Selection* pTMCRecord;		
};



/*** Section Burst ************************************************************/

class
cSection_Burst : public Gtk::VBox
{
	public:

		// Constructor
		         cSection_Burst( Gtk::Window& );
		virtual ~cSection_Burst();
		
		// Methodes
		void clear();
		std::string createCommand();
		
	private:
	
		// Methodes
		void init();
	
		// Variables
		const Glib::ustring
			sPrefix ,
			sSuffix;

		guint
			vPageNumbers ,
			vDigits_Oct ,
			vDigits_Dec ,
			vDigits_Hex;

		Glib::RefPtr<Gtk::SizeGroup>
			rSGroup_LabelPattern;

		// Widgets
		Gtk::HBox
			mHBox_SourceFile ,
			mHBox_Prefix ,
			mHBox_Digits;

		Gtk::VBox
			mVBox_Pattern;

		Gtk::Table
			mTable_Extended;

		Gtk::Frame
			mFrame_Pattern;

		Gtk::Expander
			mExpander_Extended;

		Gtk::Label
			mLabel_Pattern ,
			mLabel_Extended ,
			mLabel_SourceFile ,
			mLabel_Prefix ,
			mLabel_Base ,
			mLabel_Digits ,
			mLabel_Suffix;

		Gtk::Entry
			mEntry_Prefix ,
		    mEntry_Suffix;

		Glib::RefPtr<Gtk::Adjustment>	// Declaration of Glib::RefPtr<Gtk::Adjustment> before Gtk::SpinButton!!!
			rAdjust_Digits;

		Gtk::SpinButton					// Declaration of Gtk::SpinButton behind Glib::RefPtr<Gtk::Adjustment>!!!
			mSButton_Digits;

		Gtk::RadioButtonGroup
			mRBGroup_CounterDigits;

		Gtk::RadioButton
			mRButton_Auto ,
		    mRButton_Manual;

		Gtk::CheckButton
			mCButton_Extension;

		cCBox_CountingBase
			mCBox_CountingBase;

		cFCButton_Pdf
			mFCButton_SourceFile;

		cFCDialog_SelectFolder
			mFCDialog_SelectFolder;

		// Signal Handler
		inline void onFCButton_SourceFile_file_set() {

			vPageNumbers = Pdfchain::count_page_numbers( mFCButton_SourceFile.get_filename() );

			vDigits_Oct = Pdfchain::count_digits_of_guint_oct( vPageNumbers );
			vDigits_Dec = Pdfchain::count_digits_of_guint_dec( vPageNumbers );
			vDigits_Hex = Pdfchain::count_digits_of_guint_hex( vPageNumbers );

			onCBox_CountingBase_changed();
			return;
		}
		
		inline void onEntryIcon_Prefix_pressed( 
			Gtk::EntryIconPosition icon_pos ,
			const GdkEventButton* event )
		{
			mEntry_Prefix.set_text( sPrefix );
			return;
		}
		
		inline void onCBox_CountingBase_changed() {

			Gtk::TreeModel::iterator
				iter = mCBox_CountingBase.get_active();

			cTMCRecord_Selection*
				pt_record = mCBox_CountingBase.rLStore->getTMCRecord();

			if ( mRButton_Auto.get_active() ) {
				switch ( (*iter)[pt_record->mTMColumn_ID] ) {

					case Pdfchain::Id::COUNT_OCT:
						rAdjust_Digits->set_value( static_cast<double>( vDigits_Oct ) );
						break;
				
					case Pdfchain::Id::COUNT_DEC:
						rAdjust_Digits->set_value( static_cast<double>( vDigits_Dec ) );
						break;
					
					case Pdfchain::Id::COUNT_HEX:
						rAdjust_Digits->set_value( static_cast<double>( vDigits_Hex ) );
						break;
				}
			}

			return;
		}

		inline void onRButton_Auto_toggled() {
			mSButton_Digits.set_sensitive( mRButton_Manual.get_active() );
			onCBox_CountingBase_changed();
			return;
		}
		
		inline void onEntryIcon_Suffix_pressed(
			Gtk::EntryIconPosition icon_pos ,
			const GdkEventButton* event )
		{
			mEntry_Suffix.set_text( sSuffix );
			return;
		}
};


#endif