1
/* -*- c-file-style: "xxdiff" -*- */
1
2
/******************************************************************************\
2
* $Id: resParser.cpp,v 1.56 2002/02/27 02:46:54 blais Exp $
3
* $Date: 2002/02/27 02:46:54 $
3
* $RCSfile: resParser.cpp,v $
5
* Copyright (C) 1999-2001 Martin Blais <blais@iro.umontreal.ca>
5
* Copyright (C) 1999-2003 Martin Blais <blais@furius.ca>
7
7
* This program is free software; you can redistribute it and/or modify
8
8
* it under the terms of the GNU General Public License as published by
130
142
{ "VerticalLinePosition", VERTICAL_LINE_POS,
131
143
"Initial column to draw vertical alignment line." },
133
{ "ClipboardFormat", CLIPBOARD_FORMAT,
134
"Format of formatted clipboard text." },
145
{ "ClipboardHeaderFormat", CLIPBOARD_HEAD_FORMAT,
146
"Format of header for selection of text for formatted clipboard text." },
148
{ "ClipboardLineFormat", CLIPBOARD_LINE_FORMAT,
149
"Format of each selection line for formatted clipboard text." },
136
151
{ "HorizontalDiffType", HORDIFF_TYPE,
137
152
"Type of horizontal diffs display. Can be one of \
174
189
{ "ExitIfNoConflicts", EXIT_IF_NO_CONFLICTS,
175
190
"If true, exit if after an automatic merge there are no conflicts." },
192
{ "ExitWithMergeStatus", EXIT_WITH_MERGE_STATUS,
193
"If true, exit with error code 0 if all merges selected and saved." },
177
195
{ "AutoSelectMerge", SELECT_MERGE,
178
196
"Pre-selected non-conflictual regions as an automatic merge would." },
180
198
{ "IgnoreHorizontalWhitespace", IGNORE_HORIZONTAL_WS,
181
199
"Ignore horizontal whitespace in horizontal diffs." },
201
{ "IgnorePerHunkWhitespace", IGNORE_PERHUNK_WS,
202
"For each hunk, ignore hunk if there are only whitespace and line break \
203
changes within that hunk. This can be useful for ignoring code reformatting \
204
for certain source code languages that allow it (e.g. C++)." },
183
206
{ "FormatClipboardText", FORMAT_CLIPBOARD_TEXT,
184
"Enables clipboard (copy-paste) formatting. If disable, text that goes \
207
"Enables clipboard (copy-paste) formatting. If disabled, text that goes \
185
208
in the clipboard is simply left unformatted." },
187
210
{ "IgnoreErrors", IGNORE_ERRORS,
193
216
{ "DisableCursorDisplay", DISABLE_CURSOR_DISPLAY,
194
217
"Disables displaying the line cursor." },
219
{ "DrawPatternInFillerLines", DRAW_PATTERN_IN_FILLER_LINES,
220
"Some people like to have a pattern drawn for filler lines to make it \
221
really dead obvious that they are not real lines, but just inserted for \
222
display purpose. This setting enables it." },
196
224
{ "HideCarriageReturns", HIDE_CR,
197
225
"Hides CR characters found in files created under DOS/Windows." },
213
241
"(Not implemented) Use internal diff computation, does not spawn external \
216
#ifdef XX_ENABLE_FORCE_SAVE_MERGED_FILE
217
{ "ForceSaveMergedFIle", FORCE_SAVE_MERGED_FILE,
218
"Put xxdiff in a mode where it is forced to save to the merged file. This \
219
option is made available as a resource because it was easy but you\'ll most \
220
likely want to use it rather from the command line." }
225
246
/* Be careful: order must be the same as for token declaration. */
226
247
XxBoolOpt boolMap[] = {
227
248
BOOL_EXIT_ON_SAME,
228
249
BOOL_EXIT_IF_NO_CONFLICTS,
250
BOOL_EXIT_WITH_MERGE_STATUS,
229
251
BOOL_SELECT_MERGE,
230
252
BOOL_IGNORE_HORIZONTAL_WS,
253
BOOL_IGNORE_PERHUNK_WS,
231
254
BOOL_FORMAT_CLIPBOARD_TEXT,
232
255
BOOL_IGNORE_ERRORS,
233
256
BOOL_WARN_ABOUT_UNSAVED,
234
257
BOOL_DISABLE_CURSOR_DISPLAY,
258
BOOL_DRAW_PATTERN_IN_FILLER_LINES,
236
260
BOOL_DIRDIFF_IGNORE_FILE_CHANGES,
237
261
BOOL_DIRDIFF_BUILD_FROM_OUTPUT,
238
262
BOOL_DIRDIFF_RECURSIVE,
239
263
BOOL_USE_INTERNAL_DIFF
240
#ifdef XX_ENABLE_FORCE_SAVE_MERGED_FILE
241
BOOL_FORCE_SAVE_MERGED_FILE
245
266
StringToken accelList[] = {
246
267
{ "Exit", ACCEL_EXIT, 0 },
268
{ "ExitAccept", ACCEL_EXIT_ACCEPT, 0 },
269
{ "ExitMerged", ACCEL_EXIT_MERGED, 0 },
270
{ "ExitReject", ACCEL_EXIT_REJECT, 0 },
247
271
{ "OpenLeft", ACCEL_OPEN_LEFT, 0 },
248
272
{ "OpenMiddle", ACCEL_OPEN_MIDDLE, 0 },
249
273
{ "OpenRight", ACCEL_OPEN_RIGHT, 0 },
250
274
{ "SaveAsLeft", ACCEL_SAVE_AS_LEFT, 0 },
251
275
{ "SaveAsMiddle", ACCEL_SAVE_AS_MIDDLE, 0 },
252
276
{ "SaveAsRight", ACCEL_SAVE_AS_RIGHT, 0 },
277
{ "SaveAsMerged", ACCEL_SAVE_AS_MERGED, 0 },
253
278
{ "SaveAs", ACCEL_SAVE_AS, 0 },
254
279
{ "SaveSelectedOnly", ACCEL_SAVE_SELECTED_ONLY, 0 },
255
280
{ "EditLeft", ACCEL_EDIT_LEFT, 0 },
256
281
{ "EditMiddle", ACCEL_EDIT_MIDDLE, 0 },
257
282
{ "EditRight", ACCEL_EDIT_RIGHT, 0 },
283
{ "SaveOptions", ACCEL_SAVE_OPTIONS, 0 },
258
284
{ "Search", ACCEL_SEARCH, 0 },
259
285
{ "SearchForward", ACCEL_SEARCH_FORWARD, 0 },
260
286
{ "SearchBackward", ACCEL_SEARCH_BACKWARD, 0 },
268
294
{ "EditDiffOptions", ACCEL_EDIT_DIFF_OPTIONS, 0 },
269
295
{ "EditDisplayOptions", ACCEL_EDIT_DISPLAY_OPTIONS, 0 },
270
296
{ "DiffFilesAtCursor", ACCEL_DIFF_FILES_AT_CURSOR, 0 },
297
{ "NextAndDiffFiles", ACCEL_NEXT_AND_DIFF_FILES, 0 },
271
298
{ "CopyFileRightToLeft", ACCEL_COPY_RIGHT_TO_LEFT, 0 },
272
299
{ "CopyFileLeftToRight", ACCEL_COPY_LEFT_TO_RIGHT, 0 },
273
300
{ "RemoveFileLeft", ACCEL_REMOVE_LEFT, 0 },
328
355
{ "HorizontalDiffSingle", ACCEL_HORDIFF_SINGLE, 0 },
329
356
{ "HorizontalDiffMultiple", ACCEL_HORDIFF_MULTIPLE, 0 },
330
357
{ "ToggleIgnoreHorizontalWhitespace", ACCEL_TOGGLE_IGNORE_HORIZONTAL_WS, 0 },
358
{ "ToggleIgnorePerHunkWhitespace", ACCEL_TOGGLE_IGNORE_PERHUNK_WS, 0 },
331
359
{ "ToggleFormatClipboardText", ACCEL_TOGGLE_FORMAT_CLIPBOARD_TEXT, 0 },
332
360
{ "IgnoreFileNone", ACCEL_IGNORE_FILE_NONE, 0 },
333
361
{ "IgnoreFileLeft", ACCEL_IGNORE_FILE_LEFT, 0 },
335
363
{ "IgnoreFileRight", ACCEL_IGNORE_FILE_RIGHT, 0 },
336
364
{ "HelpManPage", ACCEL_HELP_MAN_PAGE, 0 },
337
365
{ "HelpOnContext", ACCEL_HELP_ON_CONTEXT, 0 },
338
{ "HelpGenInitFile", ACCEL_HELP_GEN_INIT_FILE, 0 },
339
366
{ "HelpAbout", ACCEL_HELP_ABOUT, 0 },
340
{ "MergedClose", ACCEL_MERGED_CLOSE, 0 }
367
{ "MergedClose", ACCEL_MERGED_CLOSE, 0 },
368
{ "FontResizeBigger", ACCEL_FONT_RESIZE_BIGGER, 0 },
369
{ "FontResizeSmaller", ACCEL_FONT_RESIZE_SMALLER, 0 },
343
372
StringToken colorList[] = {
345
374
{ "Same", COLOR_SAME,
346
375
" Identical text " },
376
{ "SameBlank", COLOR_SAME_BLANK,
377
" Identical text (blank side, for filler lines when ignore-blank-lines "
348
380
{ "Insert", COLOR_INSERT,
349
381
" Insert text (side with text) " },
396
428
" Selected text " },
397
429
{ "SelectedSup", COLOR_SELECTED_SUP,
398
430
" Selected text (shadowed) " },
432
{ "IgnoreDisplay", COLOR_IGNORE_DISPLAY,
433
" Ignored for display purposes " },
434
{ "IgnoreDisplaySup", COLOR_IGNORE_DISPLAY_SUP,
435
" Ignored for display purposes (shadowed) " },
436
{ "IgnoreDisplayOnly", COLOR_IGNORE_DISPLAY_ONLY,
437
" Ignored for display purposes (only text on lines) " },
438
{ "IgnoreDisplayNonly", COLOR_IGNORE_DISPLAY_NONLY,
439
" Ignored for display purposes (blank side) " },
400
441
{ "Deleted", COLOR_DELETED,
401
442
" Deleted text " },
619
662
else if ( sscanf( vchar, "%dx%d-%d-%d", &w, &h, &l, &t ) == 4 ) {
620
663
geometry = QRect( dsize.width()-l-w, dsize.height()-t-h, w, h );
665
else if ( sscanf( vchar, "+%d+%d", &l, &t ) == 2 ) {
666
QRect defGeom = XxResources::getDefaultGeometry();
667
geometry = QRect( l, t, defGeom.width(), defGeom.height() );
669
else if ( sscanf( vchar, "-%d+%d", &l, &t ) == 2 ) {
670
QRect defGeom = XxResources::getDefaultGeometry();
672
geometry = QRect( dsize.width()-l-w, t, defGeom.width(), defGeom.height() );
674
else if ( sscanf( vchar, "+%d-%d", &l, &t ) == 2 ) {
675
QRect defGeom = XxResources::getDefaultGeometry();
676
h = defGeom.height();
677
geometry = QRect( l, dsize.height()-t-h, defGeom.width(), defGeom.height() );
679
else if ( sscanf( vchar, "-%d-%d", &l, &t ) == 2 ) {
680
QRect defGeom = XxResources::getDefaultGeometry();
682
h = defGeom.height();
683
geometry = QRect( dsize.width()-l-w, dsize.height()-t-h,
684
defGeom.width(), defGeom.height() );
622
686
else if ( sscanf( vchar, "%dx%d", &w, &h ) == 2 ) {
623
687
geometry = QRect( -1, -1, w, h );
629
694
geometry = QRect( 0, geometry.top(), dsize.width(), geometry.height() );
1015
1089
const QFont& fontApp = res1.getFontApp();
1016
1090
if ( !XxResources::compareFonts( fontApp, res2.getFontApp() ) ) {
1017
1091
os << searchTokenName( STPARAM(kwdList), FONT_APP )
1018
<< ": \"" << fontApp.rawName() << "\"" << endl;
1093
#if (QT_VERSION >= 0x030000)
1094
<< fontApp.toString()
1096
<< fontApp.rawName()
1021
1101
const QFont& fontText = res1.getFontText();
1022
1102
if ( !XxResources::compareFonts( fontText, res2.getFontText() ) ) {
1023
1103
os << searchTokenName( STPARAM(kwdList), FONT_TEXT )
1024
<< ": \"" << fontText.rawName() << "\"" << endl;
1105
#if (QT_VERSION >= 0x030000)
1106
<< fontText.toString()
1108
<< fontText.rawName()
1027
1113
int nbcolors = sizeof(colorList)/sizeof(StringToken);
1132
if ( res1.getClipboardFormat() != res2.getClipboardFormat() ) {
1133
os << searchTokenName( STPARAM(kwdList), CLIPBOARD_FORMAT ) << ": \""
1134
<< res1.getClipboardFormat() << "\"" << endl;
1218
if ( res1.getClipboardHeadFormat() !=
1219
res2.getClipboardHeadFormat() ) {
1220
os << searchTokenName( STPARAM(kwdList), CLIPBOARD_HEAD_FORMAT ) << ": \""
1221
<< XxUtil::escapeChars( res1.getClipboardHeadFormat() ) << "\"" << endl;
1223
if ( res1.getClipboardLineFormat() !=
1224
res2.getClipboardLineFormat() ) {
1225
os << searchTokenName( STPARAM(kwdList), CLIPBOARD_LINE_FORMAT ) << ": \""
1226
<< XxUtil::escapeChars( res1.getClipboardLineFormat() ) << "\"" << endl;
1137
1229
if ( res1.getHordiffType() != res2.getHordiffType() ) {
1191
1286
const QFont& fontApp = res.getFontApp();
1192
1287
os << searchTokenName( STPARAM(kwdList), FONT_APP )
1193
<< ": \"" << fontApp.rawName().latin1() << "\"" << endl;
1289
#if (QT_VERSION >= 0x030000)
1290
<< fontApp.toString()
1292
<< fontApp.rawName()
1195
1296
const QFont& fontText = res.getFontText();
1196
1297
os << searchTokenName( STPARAM(kwdList), FONT_TEXT )
1197
<< ": \"" << fontText.rawName().latin1() << "\"" << endl;
1299
#if (QT_VERSION >= 0x030000)
1300
<< fontText.toString()
1302
<< fontText.rawName()
1199
1306
int nbcolors = sizeof(colorList)/sizeof(StringToken);
1200
1307
const char* colorStr = searchTokenName( STPARAM(kwdList), COLOR );
1274
1381
<< b1.latin1() << "\"" << endl;
1277
os << searchTokenName( STPARAM(kwdList), CLIPBOARD_FORMAT ) << ": \""
1278
<< res.getClipboardFormat() << "\"" << endl;
1384
os << searchTokenName( STPARAM(kwdList), CLIPBOARD_HEAD_FORMAT ) << ": \""
1385
<< XxUtil::escapeChars( res.getClipboardHeadFormat() ) << "\"" << endl;
1386
os << searchTokenName( STPARAM(kwdList), CLIPBOARD_LINE_FORMAT ) << ": \""
1387
<< XxUtil::escapeChars( res.getClipboardLineFormat() ) << "\"" << endl;
1280
1389
const char* hdtstr[3] = { "None", "Single", "Multiple" };
1281
1390
os << searchTokenName( STPARAM(kwdList), HORDIFF_TYPE ) << ": "
1608
1739
const StringToken* tok =
1609
searchToken( STPARAM(kwdList), CLIPBOARD_FORMAT );
1610
QString cf = XxHelp::xmlize( res.getClipboardFormat() );
1740
searchToken( STPARAM(kwdList), CLIPBOARD_HEAD_FORMAT );
1741
QString cf = XxHelp::xmlize( res.getClipboardHeadFormat() );
1742
os << tok->_name << ": \"" << cf << "\"" << endl;
1745
os << tok->_desc << endl;
1750
const StringToken* tok =
1751
searchToken( STPARAM(kwdList), CLIPBOARD_LINE_FORMAT );
1752
QString cf = XxHelp::xmlize( res.getClipboardLineFormat() );
1611
1753
os << tok->_name << ": \"" << cf << "\"" << endl;