Changeset 436

User picture

Author: nrymanov@gmail.com

(2010/02/01 13:35) About 2 years ago

see #29 - Редизайн и унификация пользовательского интерфейса

Affected files

Updated trunk/Forms/frm_editor.dfm Download diff

435436
1
object frmEditor: TfrmEditor
1
object frmEditor: TfrmEditor
2
  Left = 0
2
  Left = 0
3
  Top = 0
3
  Top = 0
4
  BorderStyle = bsToolWindow
4
  BorderIcons = [biSystemMenu]
5
  Caption = '   '#1042#1074#1077#1076#1080#1090#1077' '#1090#1077#1082#1089#1090
5
  Caption = #1042#1074#1077#1076#1080#1090#1077' '#1090#1077#1082#1089#1090' '#1074#1099#1088#1072#1078#1077#1085#1080#1103
6
  ClientHeight = 322
6
  ClientHeight = 200
7
  ClientWidth = 245
7
  ClientWidth = 350
8
  Color = clBtnFace
8
  Color = clBtnFace
9
  Constraints.MinHeight = 236
10
  Constraints.MinWidth = 366
9
  Font.Charset = DEFAULT_CHARSET
11
  Font.Charset = DEFAULT_CHARSET
10
  Font.Color = clWindowText
12
  Font.Color = clWindowText
11
  Font.Height = -11
13
  Font.Height = -11
12
  Font.Name = 'Tahoma'
14
  Font.Name = 'Tahoma'
13
  Font.Style = []
15
  Font.Style = []
14
  OldCreateOrder = False
16
  OldCreateOrder = False
17
  Position = poOwnerFormCenter
15
  PixelsPerInch = 96
18
  PixelsPerInch = 96
16
  TextHeight = 13
19
  TextHeight = 13
17
  object mmMemo: TMemo
20
  object mmMemo: TMemo
18
    AlignWithMargins = True
21
    AlignWithMargins = True
19
    Left = 3
22
    Left = 3
20
    Top = 82
23
    Top = 3
21
    Width = 239
24
    Width = 344
22
    Height = 210
25
    Height = 105
23
    Margins.Bottom = 30
24
    Align = alClient
26
    Align = alClient
25
    ScrollBars = ssVertical
27
    ScrollBars = ssVertical
26
    TabOrder = 0
28
    TabOrder = 0
27
    ExplicitWidth = 200
28
    ExplicitHeight = 223
29
  end
29
  end
30
  object RzBitBtn1: TRzBitBtn
30
  object RzGroupBox4: TPanel
31
    Left = 65
32
    Top = 296
33
    Width = 127
34
    TabOrder = 1
35
    OnClick = RzBitBtn1Click
36
    Kind = bkOK
37
  end
38
  object RzGroupBox4: TRzGroupBox
39
    AlignWithMargins = True
31
    AlignWithMargins = True
40
    Left = 3
32
    Left = 3
41
    Top = 0
33
    Top = 111
42
    Width = 239
34
    Width = 344
43
    Height = 76
35
    Height = 45
44
    Margins.Top = 0
36
    Margins.Top = 0
45
    Align = alTop
37
    Align = alBottom
46
    Alignment = taCenter
38
    BevelOuter = bvNone
47
    TabOrder = 2
39
    TabOrder = 1
48
    ExplicitLeft = 58
40
    object btnNotEq: TButton
49
    ExplicitTop = -8
41
      Tag = 52
50
    ExplicitWidth = 375
42
      Left = 306
51
    object btnInsertFilterTemplate: TRzToolButton
52
      Tag = 50
53
      Left = 10
54
      Top = 11
43
      Top = 11
55
      Width = 31
44
      Width = 31
56
      Flat = False
45
      Height = 25
57
      ShowCaption = True
58
      UseToolbarShowCaption = False
59
      Caption = 'LIKE'
60
      OnClick = btnInsertFilterTemplateClick
61
    end
62
    object RzToolButton3: TRzToolButton
63
      Tag = 52
64
      Left = 84
65
      Top = 42
66
      Width = 31
67
      Flat = False
68
      ShowCaption = True
69
      UseToolbarShowCaption = False
70
      Caption = '<>'
46
      Caption = '<>'
71
      OnClick = btnInsertFilterTemplateClick
47
      TabOrder = 8
48
      OnClick = btnLikeClick
72
    end
49
    end
73
    object RzToolButton6: TRzToolButton
50
    object btnBraket: TButton
74
      Tag = 55
51
      Tag = 55
75
      Left = 47
52
      Left = 158
76
      Top = 11
53
      Top = 11
77
      Width = 31
54
      Width = 31
78
      Flat = False
55
      Height = 25
79
      ShowCaption = True
80
      UseToolbarShowCaption = False
81
      Caption = '()'
56
      Caption = '()'
82
      OnClick = btnInsertFilterTemplateClick
57
      TabOrder = 4
58
      OnClick = btnLikeClick
83
    end
59
    end
84
    object RzToolButton5: TRzToolButton
60
    object btnGreat: TButton
85
      Tag = 54
61
      Tag = 54
86
      Left = 121
62
      Left = 232
87
      Top = 11
63
      Top = 11
88
      Width = 31
64
      Width = 31
89
      Flat = False
65
      Height = 25
90
      ShowCaption = True
91
      UseToolbarShowCaption = False
92
      Caption = '>'
66
      Caption = '>'
93
      OnClick = btnInsertFilterTemplateClick
67
      TabOrder = 6
68
      OnClick = btnLikeClick
94
    end
69
    end
95
    object RzToolButton4: TRzToolButton
70
    object btnLess: TButton
96
      Tag = 53
71
      Tag = 53
97
      Left = 84
72
      Left = 195
98
      Top = 11
73
      Top = 11
99
      Width = 31
74
      Width = 31
100
      Flat = False
75
      Height = 25
101
      ShowCaption = True
102
      UseToolbarShowCaption = False
103
      Caption = '<'
76
      Caption = '<'
104
      OnClick = btnInsertFilterTemplateClick
77
      TabOrder = 5
78
      OnClick = btnLikeClick
105
    end
79
    end
106
    object RzToolButton7: TRzToolButton
80
    object btnAnd: TButton
107
      Tag = 56
81
      Tag = 56
108
      Left = 10
82
      Left = 47
109
      Top = 42
83
      Top = 11
110
      Width = 31
84
      Width = 31
111
      Flat = False
85
      Height = 25
112
      ShowCaption = True
113
      UseToolbarShowCaption = False
114
      Caption = 'AND'
86
      Caption = 'AND'
115
      OnClick = btnInsertFilterTemplateClick
87
      TabOrder = 1
88
      OnClick = btnLikeClick
116
    end
89
    end
117
    object RzToolButton8: TRzToolButton
90
    object btnOr: TButton
118
      Tag = 57
91
      Tag = 57
119
      Left = 47
92
      Left = 84
120
      Top = 42
93
      Top = 11
121
      Width = 31
94
      Width = 31
122
      Flat = False
95
      Height = 25
123
      ShowCaption = True
124
      UseToolbarShowCaption = False
125
      Caption = 'OR'
96
      Caption = 'OR'
126
      OnClick = btnInsertFilterTemplateClick
97
      TabOrder = 2
98
      OnClick = btnLikeClick
127
    end
99
    end
128
    object RzToolButton9: TRzToolButton
100
    object btnNot: TButton
129
      Tag = 58
101
      Tag = 58
130
      Left = 158
102
      Left = 121
131
      Top = 42
103
      Top = 11
132
      Width = 31
104
      Width = 31
133
      Flat = False
105
      Height = 25
134
      ShowCaption = True
135
      UseToolbarShowCaption = False
136
      Caption = 'NOT'
106
      Caption = 'NOT'
137
      OnClick = btnInsertFilterTemplateClick
107
      TabOrder = 3
108
      OnClick = btnLikeClick
138
    end
109
    end
139
    object RzToolButton1: TRzToolButton
110
    object btnCommas: TButton
140
      Tag = 59
111
      Tag = 59
141
      Left = 121
112
      Left = 269
142
      Top = 42
113
      Top = 11
143
      Width = 31
114
      Width = 31
144
      Flat = False
115
      Height = 25
145
      ShowCaption = True
146
      UseToolbarShowCaption = False
147
      Caption = '" "'
116
      Caption = '" "'
148
      OnClick = btnInsertFilterTemplateClick
117
      TabOrder = 7
118
      OnClick = btnLikeClick
149
    end
119
    end
120
    object btnLike: TButton
121
      Tag = 50
122
      Left = 10
123
      Top = 11
124
      Width = 31
125
      Height = 25
126
      Caption = 'LIKE'
127
      TabOrder = 0
128
      OnClick = btnLikeClick
129
    end
150
  end
130
  end
131
  object pnButtons: TPanel
132
    Left = 0
133
    Top = 159
134
    Width = 350
135
    Height = 41
136
    Align = alBottom
137
    BevelOuter = bvNone
138
    Caption = 'pnButtons'
139
    ShowCaption = False
140
    TabOrder = 2
141
    DesignSize = (
142
      350
143
      41)
144
    object btnOk: TButton
145
      Left = 186
146
      Top = 10
147
      Width = 75
148
      Height = 25
149
      Anchors = [akTop, akRight]
150
      Caption = '&'#1057#1086#1093#1088#1072#1085#1080#1090#1100
151
      Default = True
152
      ModalResult = 1
153
      TabOrder = 0
154
    end
155
    object btnCancel: TButton
156
      Left = 267
157
      Top = 10
158
      Width = 75
159
      Height = 25
160
      Anchors = [akTop, akRight]
161
      Cancel = True
162
      Caption = '&'#1054#1090#1084#1077#1085#1072
163
      ModalResult = 2
164
      TabOrder = 1
165
    end
166
  end
151
end
167
end

Updated trunk/Forms/frm_editor.pas Download diff

435436
1
(* *****************************************************************************
2
  *
3
  * MyHomeLib
4
  *
5
  * Copyright (C) 2008-2010 Aleksey Penkov
6
  *
7
  * Authors Aleksey Penkov  alex.penkov@gmail.com
8
  *         Nick Rymanov    nrymanov@gmail.com
9
  ****************************************************************************** *)
10
1
unit frm_editor;
11
unit frm_editor;
2
12
3
interface
13
interface
...
...
4
14
5
uses
15
uses
6
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
16
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7
  Dialogs, RzButton, StdCtrls, ExtCtrls, RzPanel;
17
  Dialogs, StdCtrls, ExtCtrls;
8
18
9
type
19
type
10
  TfrmEditor = class(TForm)
20
  TfrmEditor = class(TForm)
11
    mmMemo: TMemo;
21
    mmMemo: TMemo;
12
    RzBitBtn1: TRzBitBtn;
22
    RzGroupBox4: TPanel;
13
    RzGroupBox4: TRzGroupBox;
23
    btnLike: TButton;
14
    btnInsertFilterTemplate: TRzToolButton;
24
    btnNotEq: TButton;
15
    RzToolButton3: TRzToolButton;
25
    btnBraket: TButton;
16
    RzToolButton6: TRzToolButton;
26
    btnGreat: TButton;
17
    RzToolButton5: TRzToolButton;
27
    btnLess: TButton;
18
    RzToolButton4: TRzToolButton;
28
    btnAnd: TButton;
19
    RzToolButton7: TRzToolButton;
29
    btnOr: TButton;
20
    RzToolButton8: TRzToolButton;
30
    btnNot: TButton;
21
    RzToolButton9: TRzToolButton;
31
    btnCommas: TButton;
22
    RzToolButton1: TRzToolButton;
32
    pnButtons: TPanel;
23
    procedure RzBitBtn1Click(Sender: TObject);
33
    btnOk: TButton;
24
    procedure btnInsertFilterTemplateClick(Sender: TObject);
34
    btnCancel: TButton;
35
    procedure btnLikeClick(Sender: TObject);
25
  private
36
  private
26
    { Private declarations }
27
    procedure SetText(Value: string);
37
    procedure SetText(Value: string);
28
    function GetText:string;
38
    function GetText: string;
29
39
30
  public
40
  public
31
    { Public declarations }
41
    property Text: string read GetText write SetText;
32
    property Text:string read GetText write SetText;
33
34
  end;
42
  end;
35
43
36
var
44
var
...
...
40
48
41
{$R *.dfm}
49
{$R *.dfm}
42
50
43
procedure TfrmEditor.btnInsertFilterTemplateClick(Sender: TObject);
51
procedure TfrmEditor.btnLikeClick(Sender: TObject);
44
var
52
var
45
   OldText: string;
53
  p: integer;
46
   p: integer;
54
  AddText: string;
47
   AddText: string;
55
  Offset: integer;
48
   Offset : integer;
49
begin
56
begin
50
  OldText := mmMemo.Lines.Text;
51
52
  p := mmMemo.SelStart;
57
  p := mmMemo.SelStart;
53
58
54
  case (Sender as TrzToolButton).Tag of
59
  if Sender = btnLike then
55
      50: begin
60
  begin
56
            AddText := 'LIKE "%%"';
61
    AddText := 'LIKE "%%"';
57
            OffSet  := P + 7;
62
    Offset := p + 7;
58
          end;
63
  end
59
      51: begin
64
  {
60
            AddText := '=""';
65
  else if Sender = btnEq then
61
            OffSet  := P + 2;
66
  begin
62
          end;
67
    AddText := '=""';
63
      52: begin
68
    Offset := p + 2;
64
            AddText := '<> ""';
69
  end
65
            OffSet  := P + 4;
70
  }
66
          end;
71
  else if Sender = btnNotEq then
67
      53: begin
72
  begin
68
            AddText := '<""';
73
    AddText := '<> ""';
69
            OffSet  := P + 2;
74
    Offset := p + 4;
70
          end;
75
  end
71
      54: begin
76
  else if Sender = btnLess then
72
            AddText := '>""';
77
  begin
73
            OffSet  := P + 2;
78
    AddText := '<""';
74
          end;
79
    Offset := p + 2;
75
      55: begin
80
  end
76
            AddText := '("")';
81
  else if Sender = btnGreat then
77
            OffSet  := P + 2;
82
  begin
78
          end;
83
    AddText := '>""';
79
      56: begin
84
    Offset := p + 2;
80
            AddText := ' AND ';
85
  end
81
            OffSet  := P + 5;
86
  else if Sender = btnBraket then
82
          end;
87
  begin
83
      57: begin
88
    AddText := '("")';
84
            AddText := ' OR ';
89
    Offset := p + 2;
85
            OffSet  := P + 4;
90
  end
86
          end;
91
  else if Sender = btnAnd then
87
       58: begin
92
  begin
88
            AddText := ' NOT ';
93
    AddText := ' AND ';
89
            OffSet  := P + 5;
94
    Offset := p + 5;
90
          end;
95
  end
91
       59: begin
96
  else if Sender = btnOr then
92
            AddText := '""';
97
  begin
93
            OffSet  := P + 1;
98
    AddText := ' OR ';
94
          end;
99
    Offset := p + 4;
95
    end;
100
  end
96
  Insert(AddText + ' ',OldText, P + 1);
101
  else if Sender = btnNot then
97
102
  begin
98
  mmMemo.Lines.Text := OldText;
103
    AddText := ' NOT ';
104
    Offset := p + 5;
105
  end
106
  else if Sender = btnCommas then
107
  begin
108
    AddText := '""';
109
    Offset := p + 1;
110
  end;
111
  mmMemo.SelText := AddText;
99
  mmMemo.SelStart := Offset;
112
  mmMemo.SelStart := Offset;
100
  mmMemo.SelLength := 0;
113
  mmMemo.SelLength := 0;
114
  mmMemo.SetFocus;
101
end;
115
end;
102
116
103
function TfrmEditor.GetText: string;
117
function TfrmEditor.GetText: string;
...
...
105
  Result := mmMemo.Lines.Text;
119
  Result := mmMemo.Lines.Text;
106
end;
120
end;
107
121
108
procedure TfrmEditor.RzBitBtn1Click(Sender: TObject);
109
begin
110
  Close;
111
end;
112
113
procedure TfrmEditor.SetText(Value: string);
122
procedure TfrmEditor.SetText(Value: string);
114
begin
123
begin
115
  mmMemo.Lines.Text := Value;
124
  mmMemo.Lines.Text := Value;

Updated trunk/Forms/frm_main.pas Download diff

435436
5355
end;
5355
end;
5356
5356
5357
procedure TfrmMain.edFFullNameButtonClick(Sender: TObject);
5357
procedure TfrmMain.edFFullNameButtonClick(Sender: TObject);
5358
var
5359
  frmEditor: TfrmEditor;
5358
begin
5360
begin
5359
  frmEditor.Text := (Sender as TrzButtonEdit).Text;
5361
  frmEditor := TfrmEditor.Create(Self);
5360
  frmEditor.ShowModal;
5362
  try
5361
  (Sender as TrzButtonEdit).Text := frmEditor.Text;
5363
     frmEditor.Text := (Sender as TrzButtonEdit).Text;
5364
     if frmEditor.ShowModal = mrOk then
5365
       (Sender as TrzButtonEdit).Text := frmEditor.Text;
5366
  finally
5367
    frmEditor.Free;
5368
  end;
5362
end;
5369
end;
5363
5370
5364
procedure TfrmMain.edFFullNameKeyDown(Sender: TObject; var Key: Word;
5371
procedure TfrmMain.edFFullNameKeyDown(Sender: TObject; var Key: Word;

Updated trunk/MyhomeLib.dpr Download diff

435436
134
    // !      
    //   -  !
    Application.CreateForm(TDMUser, DMUser);
134
    // !      
    //   -  !
    Application.CreateForm(TDMUser, DMUser);
135
    Application.CreateForm(TDMCollection, DMCollection);
135
  Application.CreateForm(TDMCollection, DMCollection);
136
    Application.CreateForm(TfrmMain, frmMain);
136
  Application.CreateForm(TfrmMain, frmMain);
137
    Application.CreateForm(TfrmEditor, frmEditor);
137
  Application.CreateForm(TfrmEditBookInfo, frmEditBookInfo);
138
    Application.CreateForm(TfrmEditBookInfo, frmEditBookInfo);
138
  Application.CreateForm(TfrmGenreTree, frmGenreTree);
139
    Application.CreateForm(TfrmGenreTree, frmGenreTree);
139
  Application.CreateForm(TfrmAddnonfb2, frmAddnonfb2);
140
    Application.CreateForm(TfrmAddnonfb2, frmAddnonfb2);
140
  Application.CreateForm(TfrmConvertToFBD, frmConvertToFBD);
141
    Application.CreateForm(TfrmConvertToFBD, frmConvertToFBD);
141
  Application.CreateForm(TfrmAuthorList, frmAuthorList);
142
    Application.CreateForm(TfrmAuthorList, frmAuthorList);
142
  frmSplash.Hide;  // Hide the splash screen
143
    frmSplash.Hide;  // Hide the splash screen
144
  finally
143
  finally
145
    frmSplash.Free;  // Free the splash screen
144
    frmSplash.Free;  // Free the splash screen
146
  end;
145
  end;