Develop and Download Open Source Software

Browse Subversion Repository

Contents of /CopalPro/View.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Thu Jul 28 09:05:52 2011 UTC (12 years, 9 months ago) by kaityo
File MIME type: text/x-c++src
File size: 5648 byte(s)
First Commit
1 //---------------------------------------------------------------------------
2 //表示関係
3 //---------------------------------------------------------------------------
4 #include <vcl.h>
5 #pragma hdrstop
6
7 #include "Main.h"
8 #include "View.h"
9 #include "Script.h"
10 #include "KCodeConv.h"
11
12 //---------------------------------------------------------------------------
13 #pragma package(smart_init)
14
15 //---------------------------------------------------------------------------
16 /**
17 * すべての表示を更新
18 */
19 void
20 TFMain::UpdateAll(void) {
21 UpdateCaption();
22 UpdateStatusBar();
23 UpdateMenu();
24 SetMenuChecked();
25 }
26 //---------------------------------------------------------------------------
27 /**
28 * キャプションの更新
29 */
30 void
31 TFMain::UpdateCaption(void) {
32 Caption = FScript->GetCaptionStr();
33 }
34 //---------------------------------------------------------------------------
35 /**
36 * ステータスバーの表示を更新する
37 */
38 void
39 TFMain::UpdateStatusBar(void) {
40 StatusBar->Panels->Items[0]->Text = CurrentForm->GetCaretString();
41 StatusBar->Panels->Items[1]->Text = CopalConfig->GetLangName();
42 StatusBar->Panels->Items[2]->Text = KCodeConv::GetCodeChar(FScript->GetCode());
43 StatusBar->Panels->Items[3]->Text = KCodeConv::GetDelimiterChar(FScript->GetDelimiter());
44 AnsiString Dir = CurrentForm->GetMyCurrentDir();
45
46 StatusBar->Panels->Items[4]->Text = Dir;
47 }
48 //---------------------------------------------------------------------------
49 /**
50 * メニューやスピードボタンの表示を更新する
51 */
52 void
53 TFMain::UpdateMenu(void) {
54
55 if(MMAutoRefresh->Checked != CopalConfig->AutoRefresh) {
56 MMAutoRefresh->Checked = CopalConfig->AutoRefresh;
57 }
58
59 if(TBAutoRefresh->Down != MMAutoRefresh->Checked) {
60 TBAutoRefresh->Down = MMAutoRefresh->Checked;
61 }
62
63 if(MMReadOnly->Checked != CopalConfig->IsReadOnly()) {
64 MMReadOnly->Checked = CopalConfig->IsReadOnly();
65 }
66
67 if(TBReadOnly->Down != MMReadOnly->Checked) {
68 TBReadOnly->Down = MMReadOnly->Checked;
69 }
70
71 if(MMUseCGI->Checked != CopalConfig->UseCGI) {
72 MMUseCGI->Checked = CopalConfig->UseCGI;
73 }
74
75 if(TBUseCGI->Down != MMUseCGI->Checked) {
76 TBUseCGI->Down = MMUseCGI->Checked;
77 }
78
79 if (MMUndo->Enabled!=CurrentForm->CanUndo()) {
80 MMUndo->Enabled = CurrentForm->CanUndo();
81 }
82
83 }
84 //---------------------------------------------------------------------------
85 /**
86 * エラーを開く
87 */
88 void
89 TFMain::OpenError(void) {
90
91 if(PStdError->Visible) {
92 return;
93 }
94
95 PStdError->Height = 60;
96 PageControl->Height -= PStdError->Height;
97 PStdError->Visible = true;
98 FStdError->Visible = true;
99 Splitter->Visible = true;
100
101 Splitter->Top = PageControl->Height + PageControl->Top;
102 PStdError->Top = Splitter->Top + PStdError->Height;
103 StatusBar->Top = PStdError->Top + PStdError->Top;
104
105 }
106 //---------------------------------------------------------------------------
107 /**
108 * エラーを閉じる
109 */
110 void
111 TFMain::CloseError(void) {
112 PStdError->Visible = false;
113 Splitter->Visible = false;
114 }
115 //---------------------------------------------------------------------------
116 /**
117 * ウィンドウを変更
118 */
119 void
120 TFMain::ChangeWindow(int window) {
121 switch(window) {
122 case SCRIPT_WINDOW:
123 PageControl->ActivePage = PageControl->Pages[0];
124 CurrentForm=FScript;
125 CurrentForm->SetWindowFocus();
126 break;
127 case RESULT_WINDOW:
128 PageControl->ActivePage = PageControl->Pages[1];
129 FResult->REResult->SetFocus();
130 CurrentForm=FResult;
131 break;
132 case ERROR_WINDOW:
133 CurrentForm=FStdError;
134 OpenError();
135 FStdError->LBStdError->SetFocus();
136 break;
137 case NEXT_WINDOW:
138 if(CurrentForm == FScript){
139 ChangeWindow(RESULT_WINDOW);
140 }else if(CurrentForm == FResult){
141 if(PStdError->Visible){
142 ChangeWindow(ERROR_WINDOW);
143 }else{
144 ChangeWindow(SCRIPT_WINDOW);
145 }
146 }else{
147 ChangeWindow(SCRIPT_WINDOW);
148 }
149 break;
150 }
151 UpdateStatusBar();
152 }
153 //---------------------------------------------------------------------------
154 /**
155 * コンフィグ情報からチェックするメニューの変更をする
156 */
157 void
158 TFMain::SetMenuChecked(void) {
159
160 //文字コード設定
161 switch(CopalConfig->GetCodeMode()) {
162 case CM_AUTOSELECT:
163 MMAuto->Checked = true;
164 break;
165 case CM_SJIS:
166 MMSHIFTJIS->Checked = true;
167 break;
168 case CM_EUC:
169 MMEUC->Checked = true;
170 break;
171 case CM_JIS:
172 MMJIS->Checked = true;
173 break;
174 case CM_UTF8:
175 MMUTF8->Checked = true;
176 break;
177 }
178
179 if(CopalConfig->GetDefConfigCount()==0) {
180 return;
181 }
182
183 for(int i=0;i<MMLanguage->Count;i++) {
184 KDefConfig *df = (KDefConfig*)MMLanguage->Items[i]->Tag;
185 if(df->LangName.LowerCase()==CopalConfig->GetLangName().LowerCase()) {
186 MMLanguage->Items[i]->Checked = true;
187 return;
188 }
189 }
190 }
191 //---------------------------------------------------------------------------
192 /**
193 * 言語設定ファイル情報から言語選択メニューを作成する
194 */
195 void
196 TFMain::MakeLanguageMenu(void) {
197
198 for (int i=0;MMLanguage->Count!=0;i++) {
199 MMLanguage->Delete(0);
200 }
201
202 if(CopalConfig->GetDefConfigCount()==0) {
203 return;
204 }
205
206 for(int i=0;i<CopalConfig->GetDefConfigCount();i++) {
207 KDefConfig *df = CopalConfig->GetDefConfigAt(i);
208 TMenuItem *mi = NewItem(df->LangName,0,false,true,OnLanguageClick,0,"LangMenu"+IntToStr(i));
209 mi->Tag = (int)df;
210 mi->RadioItem = true;
211 MMLanguage->Add(mi);
212 }
213
214 //一番上を選択しておく
215 MMLanguage->Items[0]->Checked = true;
216 }
217 //---------------------------------------------------------------------------
218

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26