1 /***************************************************************************
3 TextEditor.mcc - Textediting MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005-2014 TextEditor.mcc Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 TextEditor class Support Site: http://www.sf.net/projects/texteditor-mcc
21 ***************************************************************************/
23 #include <proto/utility.h>
28 /// MangleCharacters()
29 static void MangleCharacters(struct InstData
*data
, char (*change
)(char c
))
34 struct line_node
*startline
;
35 struct line_node
*stopline
;
36 struct line_node
*_startline
;
37 struct marking newblock
;
43 NiceBlock(&data
->blockinfo
, &newblock
);
44 startx
= newblock
.startx
;
45 stopx
= newblock
.stopx
;
46 startline
= newblock
.startline
;
47 stopline
= newblock
.stopline
;
51 startx
= data
->CPos_X
;
53 startline
= data
->actualline
;
56 newblock
.enabled
= FALSE
;
57 newblock
.startline
= startline
;
58 newblock
.stopline
= stopline
;
59 newblock
.startx
= startx
;
60 newblock
.stopx
= stopx
;
63 AddToUndoBuffer(data
, ET_DELETEBLOCK
, &newblock
);
64 AddToUndoBuffer(data
, ET_PASTEBLOCK
, &newblock
);
67 _startline
= startline
;
69 while(startline
!= GetNextLine(stopline
))
71 while(startline
->line
.Contents
[startx
] != '\n')
73 if(startx
== stopx
&& startline
== stopline
)
76 startline
->line
.Contents
[startx
] = change(startline
->line
.Contents
[startx
]);
81 startline
= GetNextLine(startline
);
84 data
->HasChanged
= TRUE
;
85 RedrawArea(data
, _startx
, _startline
, stopx
, stopline
);
92 static char ChangeToUpper(char c
)
99 void Key_ToUpper(struct InstData
*data
)
101 MangleCharacters(data
, ChangeToUpper
);
106 static char ChangeToLower(char c
)
113 void Key_ToLower(struct InstData
*data
)
115 MangleCharacters(data
, ChangeToLower
);