-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
168 lines (152 loc) · 7.54 KB
/
Copy pathmainwindow.h
File metadata and controls
168 lines (152 loc) · 7.54 KB
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "ui_tabwidget.h"
#include "tabwidget.h"
#include "defines.h"
#include <QMap>
typedef unsigned char BYTE;
namespace Ui {
class MainWindow;
}
class TabWidget;
class QFile;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
UINT load_file (bool opn /* 0:再読込, 1:名前を指定して読み込み */);
UINT read_fontxfile (/* 0:失敗, 1:半角, 2:全角 (0: Failure, 1: Halfwidth, 2: Fullwidth)*/
QDataStream *stream );
void edit_set_dot (
UINT x, /* 水平位置(0:左端) */
UINT y, /* 垂直位置(0:上端) */
UINT val /* 0:クリア, 1:セット */
);
UINT edit_test_dot (
UINT x, /* 水平位置(0:左端) */
UINT y /* 垂直位置(0:上端) */
);
UINT edit_test_dot();
void file_set_changed (
bool f /* TRUE:変更あり, FALSE:変更なし */
);
void edit_set_changed (
bool f /* TRUE:変更あり, FALSE:変更なし */
);
bool save_file (int mode);
void edit_rotate (int dir); /* 1:左, 2:右, 3:上, 4:下 */
QString rangeReport();
int read_header_file(QFile* fp);
public slots:
void on_tabWidget_current_changed(int);
void fh_changed(int,int);
void fw_changed(int,int);
signals:
void code_changed(WORD, BYTE*);
void size_change(int Dbcs, int width, int height);
private:
Ui::MainWindow *ui;
TabWidget* tabWidget1;
TabWidget* tabWidget2;
QList<TabWidget*> tabs = QList<TabWidget*>();
/* フォントファイル情報 (Font file information)*/
QString FontFile[2]/*[_MAX_PATH]*/; /* 開いているファイル (Open file)*/
bool FileChanged[2]; /* ファイル変更フラグ (File change flag)*/
UINT FontWidth[2] = {9, 18}, FontHeight[2] = {18, 18}; /* フォントサイズ[ドット] (Font size [dot])*/
// BYTE CodeStat[0x10000]; /* b0:コード存在フラグ (b0: Code existence flag)*/
// BYTE FontImage[0x10000][MAX_FONT_SQ][MAX_FONT_WB];
QMap<QChar, BYTE*> fontMap = QMap<QChar, BYTE*>();
QString header = QString("/*\n\n\tFONTX version of the Public Domain X11 misc-fixed typeface.\n\thttps://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html\n\n*/\n");
QString fontName = " ";
QString hComments;
BYTE fontDbcs = 0; // Dbcs of imported or loaded font;
/* フォント編集情報 (Font editing information)*/
BYTE Dbcs = 0; /* 編集中のフォント 0:半角, 1:全角 (Editing font 0: Half-width, 1: Full-width)*/
WORD CurrentCode[2] = {0,0}; /* 編集中のコード (Code being edited)*/
bool EditChanged = false; /* 変更フラグ *///BYTE EditFont[MAX_FONT_SQ][MAX_FONT_WB];
BYTE* EditFont = nullptr; //[MAX_FONT_SQ][MAX_FONT_WB]; /* 編集バッファ (Edit buffer)*/
BYTE* CopyFont = nullptr;//[MAX_FONT_SQ][MAX_FONT_WB]; /* コピーバッファ (Copy buffer)*/
/* 文字列 */
int Loc =1; /* User locale 0:Japanese, 1:English */
// QString Str[30][2];// = {
// /* 0 */ {" - FONTXエディタ R0.05"," - FONTX Editor R0.05"},
// /* 1 */ {"無題","No name"},
// /* 2 */ {"全角, %u字","DBC, %1 chrs"},
// /* 3 */ {"半角, 256字","SBC, 256 chrs"},
// /* 4 */ {"全角フォントを保存","Save DBC Font"},
// /* 5 */ {"半角フォントを保存","Save SBC Font"},
// /* 6 */ {"FONTXファイル (*.fnt)\0*.fnt\0全てのファイル (*.*)\0*.*\0","FONTX file (*.fnt)\0*.fnt\0All file (*.*)\0*.*\0"},
// /* 7 */ {"書き込みに失敗しました.","Failed to save to the file"},
// /* 8 */ {"ファイルに保存","Save file"},
// /* 9 */ {"ファイルを開く","Open file"},
// /* 10 */ {"FONTXファイル (*.fnt)\0*.fnt\0全てのファイル (*.*)\0*.*\0","FONTX files (*.fnt)\0*.fnt\0All files (*.*)\0*.*\0"},
// /* 11 */ {"ファイルの読み込みに失敗しました.","Failed to load the file"},
// /* 12 */ {"読み込み","Load FONTX file"},
// /* 13 */ {"ファイルからインポート","Import font from a file"},
// /* 14 */ {"X11 BDF (*.bdf)\0*.bdf\0","X11 BDF (*.bdf)\0*.bdf\0"},
// /* 15 */ {"%d字読み込みました.","%d chrs imported"},
// /* 16 */ {"インポート","Import"},
// /* 17 */ {"ファイルへ書き出し","Write font as..."},
// /* 18 */ {"垂直並びLCD形式/生(半角)\0*.*\0垂直並びLCD形式/サイズヘッダ(半角)\0*.*\0指定文字限定(全角)\0*.*\0","Vertical LCD form (SBCS)\0*.*\0Vertical LCD form with size header (SBCS)\0*.*\0Specified code only (DBCS)\0*.*\0"},
// /* 19 */ {"全角フォントはこの形式で出力できません.","DBC font cannot be written in this format"},
// /* 20 */ {"%d字書き込みました.","%d chrs written"},
// /* 21 */ {"エクスポート","Export"},
// /* 22 */ {"ファイルの読み込みに失敗しました.","Failed to load file"},
// /* 23 */ {"読み込み","Load file"},
// /* 24 */ {"半角","H/W"},
// /* 25 */ {"全角","F/W"},
// /* 26 */ {"ファイルの書き出しに失敗しました.", "Failed to write file."},
// /* 27 */ {"半角フォントはこの形式で出力できません.","SBC font cannot be written in this format"},
// /* 28 */ {"出力文字を含むSJISテキストを指定","Specify SJIS text with output characters"},
// /* 29 */ {"ファイルのインポートに失敗しました.","Failed to import font"}};
void rfsh_fontinfo (void);
void read_font (
//HANDLE h, /* ファイルハンドル */
QDataStream* f,
QChar code, /* 読み込み先の文字コード (Character code of the read destination)*/
UINT fw, /* フォントの幅[dot] (Font width [dot])*/
UINT fh /* フォントの高さ[dot] (Font height [dot])*/ );
void get_font (
WORD code, /* ロードする文字コード (Character code to load)*/
BYTE* font /* ロード先編集バッファ (Load destination edit buffer) */ );
void change_code ( int dir /* 1: the next code, -1: the previous code */);
void change_tab (UINT f);
void import_file();
void export_file();
long write_vlcdfile (
QString fname,
int szinfo );
long read_bdffile (QFile* fp);
int encoded_count;
int bitmap_count;
int expectedChars;
long write_fontxfile (QString fname, BYTE flagmask);
void write_bytes(QTextStream* strm, BYTE* buf, int len);
void write_font (
//QFile* h, /* ファイルハンドル (File handle)*/
QTextStream* strm,
WORD code, /* 文字コード (Character code)*/
UINT fw, /* フォント幅[dot] (Font width [dot])*/
UINT fh /* フォント高さ[dot] (Font height [dot])*/ );
void write_font (
//QFile* h, /* ファイルハンドル (File handle)*/
QFile* h,
WORD code, /* 文字コード (Character code)*/
UINT fw, /* フォント幅[dot] (Font width [dot])*/
UINT fh /* フォント高さ[dot] (Font height [dot])*/ );
bool write_fnt_file(QString path);
QString outFile;
QString inFile; //complete filename of last input or imported file
QString currPath; //path of last input or imported file
// working variables used by write_bytes();
int ix = 0; //used by write_bytes();
int byte_count; //used by write_bytes();
QByteArray* fontx2 = new QByteArray();
//
friend class TabWidget;
friend class PreviewWidget;
};
#endif // MAINWINDOW_H