1 | *** haiku2/haiku/haiku/src/apps/stylededit/StyledEditWindow.cpp Mon Nov 29 16:11:43 2010
|
---|
2 | --- haiku/haiku/src/apps/stylededit/StyledEditWindow.cpp Mon Nov 29 20:20:09 2010
|
---|
3 | ***************
|
---|
4 | *** 401,450 ****
|
---|
5 | fClearItem->SetEnabled(false);
|
---|
6 | break;
|
---|
7 | case TEXT_CHANGED:
|
---|
8 | ! if (fUndoFlag) {
|
---|
9 | ! if (fUndoCleans) {
|
---|
10 | ! // we cleaned!
|
---|
11 | ! fClean = true;
|
---|
12 | ! fUndoCleans = false;
|
---|
13 | ! } else if (fClean) {
|
---|
14 | ! // if we were clean
|
---|
15 | ! // then a redo will make us clean again
|
---|
16 | ! fRedoCleans = true;
|
---|
17 | ! fClean = false;
|
---|
18 | }
|
---|
19 | ! // set mode
|
---|
20 | ! fCanUndo = false;
|
---|
21 | ! fCanRedo = true;
|
---|
22 | ! fUndoItem->SetLabel(B_TRANSLATE("Redo typing"));
|
---|
23 | ! fUndoItem->SetEnabled(true);
|
---|
24 | ! fUndoFlag = false;
|
---|
25 | ! } else {
|
---|
26 | ! if (fRedoFlag && fRedoCleans) {
|
---|
27 | ! // we cleaned!
|
---|
28 | ! fClean = true;
|
---|
29 | ! fRedoCleans = false;
|
---|
30 | ! } else if (fClean) {
|
---|
31 | ! // if we were clean
|
---|
32 | ! // then an undo will make us clean again
|
---|
33 | ! fUndoCleans = true;
|
---|
34 | ! fClean = false;
|
---|
35 | } else {
|
---|
36 | ! // no more cleaning from undo now...
|
---|
37 | ! fUndoCleans = false;
|
---|
38 | }
|
---|
39 | - // set mode
|
---|
40 | - fCanUndo = true;
|
---|
41 | - fCanRedo = false;
|
---|
42 | - fUndoItem->SetLabel(B_TRANSLATE("Undo typing"));
|
---|
43 | - fUndoItem->SetEnabled(true);
|
---|
44 | - fRedoFlag = false;
|
---|
45 | - }
|
---|
46 | - if (fClean) {
|
---|
47 | - fRevertItem->SetEnabled(false);
|
---|
48 | - fSaveItem->SetEnabled(fSaveMessage == NULL);
|
---|
49 | } else {
|
---|
50 | ! fRevertItem->SetEnabled(fSaveMessage != NULL);
|
---|
51 | ! fSaveItem->SetEnabled(true);
|
---|
52 | }
|
---|
53 | break;
|
---|
54 |
|
---|
55 | --- 401,455 ----
|
---|
56 | fClearItem->SetEnabled(false);
|
---|
57 | break;
|
---|
58 | case TEXT_CHANGED:
|
---|
59 | ! if(!fDiscardFakeChanged)
|
---|
60 | ! {
|
---|
61 | ! if (fUndoFlag) {
|
---|
62 | ! if (fUndoCleans) {
|
---|
63 | ! // we cleaned!
|
---|
64 | ! fClean = true;
|
---|
65 | ! fUndoCleans = false;
|
---|
66 | ! } else if (fClean) {
|
---|
67 | ! // if we were clean
|
---|
68 | ! // then a redo will make us clean again
|
---|
69 | ! fRedoCleans = true;
|
---|
70 | ! fClean = false;
|
---|
71 | ! }
|
---|
72 | ! // set mode
|
---|
73 | ! fCanUndo = false;
|
---|
74 | ! fCanRedo = true;
|
---|
75 | ! fUndoItem->SetLabel(B_TRANSLATE("Redo typing"));
|
---|
76 | ! fUndoItem->SetEnabled(true);
|
---|
77 | ! fUndoFlag = false;
|
---|
78 | ! } else {
|
---|
79 | ! if (fRedoFlag && fRedoCleans) {
|
---|
80 | ! // we cleaned!
|
---|
81 | ! fClean = true;
|
---|
82 | ! fRedoCleans = false;
|
---|
83 | ! } else if (fClean) {
|
---|
84 | ! // if we were clean
|
---|
85 | ! // then an undo will make us clean again
|
---|
86 | ! fUndoCleans = true;
|
---|
87 | ! fClean = false;
|
---|
88 | ! } else {
|
---|
89 | ! // no more cleaning from undo now...
|
---|
90 | ! fUndoCleans = false;
|
---|
91 | ! }
|
---|
92 | ! // set mode
|
---|
93 | ! fCanUndo = true;
|
---|
94 | ! fCanRedo = false;
|
---|
95 | ! fUndoItem->SetLabel(B_TRANSLATE("Undo typing"));
|
---|
96 | ! fUndoItem->SetEnabled(true);
|
---|
97 | ! fRedoFlag = false;
|
---|
98 | }
|
---|
99 | ! if (fClean) {
|
---|
100 | ! fRevertItem->SetEnabled(false);
|
---|
101 | ! fSaveItem->SetEnabled(fSaveMessage == NULL);
|
---|
102 | } else {
|
---|
103 | ! fRevertItem->SetEnabled(fSaveMessage != NULL);
|
---|
104 | ! fSaveItem->SetEnabled(true);
|
---|
105 | }
|
---|
106 | } else {
|
---|
107 | ! fDiscardFakeChanged = false;
|
---|
108 | }
|
---|
109 | break;
|
---|
110 |
|
---|
111 | ***************
|
---|
112 | *** 944,949 ****
|
---|
113 | --- 949,957 ----
|
---|
114 | fCaseSensitive = false;
|
---|
115 | fWrapAround = false;
|
---|
116 | fBackSearch = false;
|
---|
117 | +
|
---|
118 | + // fake changed message flag
|
---|
119 | + fDiscardFakeChanged = false;
|
---|
120 |
|
---|
121 | // add menubar
|
---|
122 | fMenuBar = new BMenuBar(BRect(0, 0, 0, 0), "menubar");
|
---|
123 | ***************
|
---|
124 | *** 1267,1280 ****
|
---|
125 |
|
---|
126 | BString text;
|
---|
127 | if (status == B_BAD_TYPE)
|
---|
128 | bs_printf(&text,
|
---|
129 | ! B_TRANSLATE("Error loading \"%s\":\n\tUnsupported format"), name);
|
---|
130 | else
|
---|
131 | ! bs_printf(&text, B_TRANSLATE("Error loading \"%s\":\n\t%s"),
|
---|
132 | name, strerror(status));
|
---|
133 | !
|
---|
134 | ! _ShowAlert(text, B_TRANSLATE("OK"), "", "", B_STOP_ALERT);
|
---|
135 | ! return status;
|
---|
136 | }
|
---|
137 |
|
---|
138 | // update alignment
|
---|
139 | --- 1275,1306 ----
|
---|
140 |
|
---|
141 | BString text;
|
---|
142 | if (status == B_BAD_TYPE)
|
---|
143 | + {
|
---|
144 | bs_printf(&text,
|
---|
145 | ! B_TRANSLATE("Error loading \"%s\":\n\tUnsupported format.\nThe file may contain raw data."), name);
|
---|
146 | ! _ShowAlert(text, B_TRANSLATE("OK"), "", "", B_WARNING_ALERT);
|
---|
147 | ! }
|
---|
148 | else
|
---|
149 | ! { bs_printf(&text, B_TRANSLATE("Error loading \"%s\":\n\t%s"),
|
---|
150 | name, strerror(status));
|
---|
151 | ! _ShowAlert(text, B_TRANSLATE("OK"), "", "", B_STOP_ALERT);
|
---|
152 | ! return status;
|
---|
153 | ! }
|
---|
154 | !
|
---|
155 | ! //If the type of the file is bad we display it as binary data
|
---|
156 | ! status = file.Seek(0, SEEK_SET);
|
---|
157 | ! if (status != B_OK)
|
---|
158 | ! {
|
---|
159 | ! return status;
|
---|
160 | ! }
|
---|
161 | ! char buf[1024];
|
---|
162 | ! ssize_t read_data;
|
---|
163 | ! while((read_data = file.Read(buf, 1023)) > 0)
|
---|
164 | ! {
|
---|
165 | ! buf[(int)read_data] = '\0';
|
---|
166 | ! fTextView->Insert(buf, (const text_run_array*) NULL);
|
---|
167 | ! }
|
---|
168 | ! fDiscardFakeChanged = true;
|
---|
169 | }
|
---|
170 |
|
---|
171 | // update alignment
|
---|