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
|
//
// "$Id: DiffOpenWindow.cxx 407 2006-11-13 18:54:02Z mike $"
//
// DiffOpenWindow widget code.
//
// Copyright 2005-2006 by Michael Sweet.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License v2 as published
// by the Free Software Foundation.
//
// This program 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.
//
// Contents:
//
// DiffOpenWindow::DiffOpenWindow() - Create an open/compare window.
// DiffOpenWindow::compare_cb() - Confirm the open/compare.
// DiffOpenWindow::cancel_cb() - Cancel the open/compare.
// DiffOpenWindow::dc_cb() - Handle selections in either chooser.
// DiffOpenWindow::resize() - Resize the window.
// DiffOpenWindow::show() - Show the window.
//
#include "DiffOpenWindow.h"
//
// 'DiffOpenWindow::DiffOpenWindow()' - Create an open/compare window.
//
DiffOpenWindow::DiffOpenWindow(
const char *v1, // I - First value
const char *v2) // I - Second value
: Fl_Double_Window(640, 480, "Open/Compare"),
dc1_(10, 25, 305, 410, "File/Directory 1:"),
dc2_(325, 25, 305, 410, "File/Directory 2:"),
compare_(435, 445, 120, 25, "Open/Compare"),
cancel_(565, 445, 65, 25, "Cancel")
{
end();
modal();
resizable(this);
size_range(255, 225, Fl::w(), Fl::h());
dc1_.align(FL_ALIGN_TOP_LEFT);
dc1_.callback((Fl_Callback *)dc_cb, this);
dc1_.labelfont(FL_HELVETICA_BOLD);
dc1_.value(v1);
dc2_.align(FL_ALIGN_TOP_LEFT);
dc2_.callback((Fl_Callback *)dc_cb, this);
dc2_.labelfont(FL_HELVETICA_BOLD);
dc2_.value(v2);
compare_.callback((Fl_Callback *)compare_cb, this);
compare_.shortcut(FL_Enter);
cancel_.callback((Fl_Callback *)cancel_cb, this);
}
//
// 'DiffOpenWindow::compare_cb()' - Confirm the open/compare.
//
void
DiffOpenWindow::compare_cb(
Fl_Button *b, // I - Open/compare button
DiffOpenWindow *dow) // I - Diff open window
{
dow->hide();
}
//
// 'DiffOpenWindow::cancel_cb()' - Cancel the open/compare.
//
void
DiffOpenWindow::cancel_cb(
Fl_Button *b, // I - Cancel button
DiffOpenWindow *dow) // I - Diff open window
{
dow->dc1_.deselect();
dow->dc2_.deselect();
dow->hide();
}
//
// 'DiffOpenWindow::dc_cb()' - Handle selections in either chooser.
//
void
DiffOpenWindow::dc_cb(
DiffChooser *dc, // I - Diff chooser
DiffOpenWindow *dow) // I - Diff open window
{
if (dow->dc1_.count())
{
dow->compare_.activate();
if (Fl::event_clicks())
dow->do_callback();
}
else
dow->compare_.deactivate();
}
//
// 'DiffOpenWindow::resize()' - Resize the window.
//
void
DiffOpenWindow::resize(int X, // I - X position
int Y, // I - Y position
int W, // I - Width
int H) // I - Height
{
Fl_Double_Window::resize(X, Y, W, H);
dc1_.resize(10, 25, (W - 30) / 2, H - 70);
dc2_.resize(20 + (W - 30) / 2, 25, (W - 30) / 2, H - 70);
compare_.resize(W - 205, H - 35, 120, 25);
cancel_.resize(W - 75, H - 35, 65, 25);
}
//
// 'DiffOpenWindow::show()' - Show the window.
//
void
DiffOpenWindow::show()
{
if (dc1_.count())
compare_.activate();
else
compare_.deactivate();
hotspot(this);
Fl_Double_Window::show();
}
//
// End of "$Id: DiffOpenWindow.cxx 407 2006-11-13 18:54:02Z mike $".
//
|