140 |
return(lines); |
return(lines); |
141 |
} |
} |
142 |
void |
void |
143 |
arshell_position(XmTextPosition current_position, unsigned int *total_lines |
arshell_position(XmTextPosition current_position, unsigned int *total_lines, |
144 |
unsigned int *current_line, unsigned int *current_column) |
unsigned int *current_line) |
145 |
{ |
{ |
146 |
char *text=XmTextGetString(arshell.gui.widgets.work); |
char *text=XmTextGetString(arshell.gui.widgets.work); |
147 |
XmTextPosition position=0; |
XmTextPosition position=0; |
148 |
|
XmTextPosition end_position=XmTextGetLastPosition(arshell.gui.widgets.work); |
149 |
(*total_lines)=1; |
(*total_lines)=1; |
150 |
while(position < end_position) |
while(position <= end_position) |
151 |
{ |
{ |
152 |
if(text[position]=='\n') |
if(text[position]=='\n') |
153 |
|
(*total_lines)++; |
154 |
|
if(position==current_position) |
155 |
{ |
{ |
156 |
(*total_lines)++; |
(*current_line)=(*total_lines); |
157 |
(*current_column)=0; |
if(text[current_position]=='\n') |
158 |
|
(*current_line)--; |
159 |
} |
} |
|
(*current_column)++; |
|
|
if(position==current_position) |
|
|
(*current_line)=(*total_lines); |
|
160 |
position++; |
position++; |
161 |
} |
} |
162 |
XtFree(text); |
XtFree(text); |
|
return(lines); |
|
163 |
} |
} |
164 |
void |
void |
165 |
arshell_goto_line(unsigned int line) |
arshell_goto_line(unsigned int line) |
198 |
} |
} |
199 |
|
|
200 |
void |
void |
|
arshell_status() |
|
|
{ |
|
|
char *status; |
|
|
unsigned int lines_uint, current_uint; |
|
|
float percent; |
|
|
lines_uint=arshell_text_lines(); |
|
|
current_uint=arshell_current_line(); |
|
|
percent=current_uint/lines_uint; |
|
|
asprintf(&status, "Lines:%d, Current:%d, Percent:%f", |
|
|
lines_uint, current_uint, percent*100); |
|
|
antiright_status(status); |
|
|
free(status); |
|
|
} |
|
|
void |
|
201 |
arshell_get_rid_of_modified_status() |
arshell_get_rid_of_modified_status() |
202 |
{ |
{ |
203 |
if(arshell.flags.modified) |
if(arshell.flags.modified) |
218 |
char *status; |
char *status; |
219 |
XmTextPosition last=XmTextGetLastPosition(arshell.gui.widgets.work); |
XmTextPosition last=XmTextGetLastPosition(arshell.gui.widgets.work); |
220 |
XmTextPosition current=call_pointer->newInsert; |
XmTextPosition current=call_pointer->newInsert; |
221 |
unsigned int lines_uint=arshell_text_lines(); |
unsigned int lines_uint; |
222 |
unsigned int current_uint=arshell_line(current); |
unsigned int current_uint; |
223 |
float percent=(float)current/(float)last; |
float percent; |
224 |
|
arshell_position(current, &lines_uint, ¤t_uint); |
225 |
|
percent=(float)current/(float)last; |
226 |
asprintf(&status, "Lines:%d, Current:%d, Percent:%f", |
asprintf(&status, "Lines:%d, Current:%d, Percent:%f", |
227 |
lines_uint, current_uint, percent*100); |
lines_uint, current_uint, percent*100); |
228 |
antiright_status(status); |
antiright_status(status); |
316 |
XmTextInsert(arshell.gui.widgets.work, |
XmTextInsert(arshell.gui.widgets.work, |
317 |
XmTextGetInsertionPosition(arshell.gui.widgets.work), buffer); |
XmTextGetInsertionPosition(arshell.gui.widgets.work), buffer); |
318 |
XmTextSetInsertionPosition(arshell.gui.widgets.work, 0); |
XmTextSetInsertionPosition(arshell.gui.widgets.work, 0); |
|
arshell_status(); |
|
319 |
} |
} |
320 |
void |
void |
321 |
arshell_create_default_text_entry(Widget widget_row_widget, |
arshell_create_default_text_entry(Widget widget_row_widget, |