| 1 |
|
| 2 |
#include "defextern.h" |
| 3 |
|
| 4 |
|
| 5 |
#ifndef STRICT |
| 6 |
#define STRICT |
| 7 |
#endif |
| 8 |
#include <stdio.h> |
| 9 |
#include <windows.h> |
| 10 |
#include "resource.h" |
| 11 |
#include "myfilemv.h" |
| 12 |
#include "main.h" |
| 13 |
#include "status.h" |
| 14 |
#include "paintflag.h" |
| 15 |
#include "initial.h" |
| 16 |
#include "tab.h" |
| 17 |
#include "mode.h" |
| 18 |
|
| 19 |
char mes[MAX_PATH]=""; |
| 20 |
|
| 21 |
int posPos=3; |
| 22 |
int posFile=2; |
| 23 |
int posLeft=0; |
| 24 |
|
| 25 |
void settitle(HWND &hWnd) |
| 26 |
{ |
| 27 |
int t=GetNTab(); |
| 28 |
char *p=GetNPath(); |
| 29 |
char *pf=GetNFile(); |
| 30 |
if (p==NULL || pf==NULL) return; |
| 31 |
if(MemoMode == _ON) |
| 32 |
{ |
| 33 |
wsprintf(title,"%s :memo-mode %s / %s" ,&appname ,memopath, memofile); |
| 34 |
} |
| 35 |
else if(showpathTitle) |
| 36 |
{ |
| 37 |
if( t ==tab_l) wsprintf(title,"%s ( %s / %s" ,&appname ,p ,pf ); |
| 38 |
if( t ==tab_r) wsprintf(title,"%s ) %s / %s" ,&appname ,p ,pf ); |
| 39 |
} |
| 40 |
else wsprintf(title,"%s" ,&appname); |
| 41 |
SetWindowText(hWnd, title); |
| 42 |
} |
| 43 |
|
| 44 |
void settitle(HWND &hWnd, char *d, int tab) |
| 45 |
{ |
| 46 |
char *p=d; |
| 47 |
if (p==NULL ) return; |
| 48 |
if(MemoMode == _ON) |
| 49 |
{ |
| 50 |
wsprintf(title,"%s :memo: %s" ,&appname, memofile); |
| 51 |
} |
| 52 |
else if(showpathTitle) |
| 53 |
{ |
| 54 |
if( tab ==tab_l) wsprintf(title,"%s ( %s" ,&appname ,p ); |
| 55 |
if( tab ==tab_r) wsprintf(title,"%s ) %s" ,&appname ,p ); |
| 56 |
} |
| 57 |
else wsprintf(title,"%s" ,&appname); |
| 58 |
SetWindowText(hWnd, title); |
| 59 |
} |
| 60 |
|
| 61 |
void resettitle(HWND &hWnd) |
| 62 |
{ |
| 63 |
settitle(hWnd); |
| 64 |
} |
| 65 |
|
| 66 |
void resettitle() |
| 67 |
{ |
| 68 |
settitle(hmainwnd); |
| 69 |
} |
| 70 |
|
| 71 |
void resettitle(char *d, int tab) |
| 72 |
{ |
| 73 |
settitle(hmainwnd, d, tab); |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
void setstatusbyte(char *mes) |
| 78 |
{ |
| 79 |
SendMessage(hStatus, SB_SETTEXT, |
| 80 |
(WPARAM)posLeft | 0, (LPARAM)mes); |
| 81 |
} |
| 82 |
|
| 83 |
void setstatusnum(DWORD num) |
| 84 |
{ |
| 85 |
wsprintf(mes,"%d",num); |
| 86 |
setstatus(mes); |
| 87 |
} |
| 88 |
|
| 89 |
void setstatusnum(int num,int all) |
| 90 |
{ |
| 91 |
wsprintf(mes,"%d/%d",num,all); |
| 92 |
SendMessage(hStatus, SB_SETTEXT, |
| 93 |
(WPARAM)posLeft | 0, (LPARAM)mes); |
| 94 |
} |
| 95 |
|
| 96 |
void setstatusspace(int num,int all, double space, double total) |
| 97 |
{ |
| 98 |
if(space<1000) sprintf(mes,"%d %.fMfree/%.fM", all, space,total); |
| 99 |
else sprintf(mes,"%d %10.2fGfree/%.2fG", all, space/1024,total/1024); |
| 100 |
SendMessage(hStatus, SB_SETTEXT, |
| 101 |
(WPARAM)posLeft | 0, (LPARAM)mes); |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
void setstatusonly(char *mes) |
| 107 |
{ |
| 108 |
SendMessage(hStatus, SB_SETTEXT, |
| 109 |
(WPARAM)posFile | 0, (LPARAM)mes); |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
void setstatusonly(int pos,char *mes) |
| 114 |
{ |
| 115 |
SendMessage(hStatus, SB_SETTEXT, |
| 116 |
(WPARAM)pos | 0, (LPARAM)mes); |
| 117 |
} |
| 118 |
|
| 119 |
void setstatusfullpath(char *file) |
| 120 |
{ |
| 121 |
_fullpath(mes,file,MAX_PATH); |
| 122 |
SendMessage(hStatus, SB_SETTEXT, |
| 123 |
(WPARAM)posFile | 0, (LPARAM)mes); |
| 124 |
} |
| 125 |
|
| 126 |
|
| 127 |
void setstatusMousepos(int num, int x, int y) |
| 128 |
{ |
| 129 |
wsprintf(mes,"%d:%d,%d",num, x,y); |
| 130 |
SendMessage(hStatus, SB_SETTEXT, |
| 131 |
(WPARAM)posPos | 0, (LPARAM)mes); |
| 132 |
} |
| 133 |
|
| 134 |
void setstatusMousepos(int x) |
| 135 |
{ |
| 136 |
wsprintf(mes,"%d",x); |
| 137 |
SendMessage(hStatus, SB_SETTEXT, |
| 138 |
(WPARAM)posPos | 0, (LPARAM)mes); |
| 139 |
} |
| 140 |
|
| 141 |
// log�������� |
| 142 |
|
| 143 |
void setstatus(char *mes) |
| 144 |
{ |
| 145 |
if(mes==NULL) return; |
| 146 |
if(strlen(mes)==0) return; |
| 147 |
SYSTEMTIME st; |
| 148 |
char jikan[10]; |
| 149 |
char form[]="%02d:%02d:%02d"; |
| 150 |
|
| 151 |
GetLocalTime(&st); |
| 152 |
wsprintf( |
| 153 |
jikan, |
| 154 |
form, |
| 155 |
|
| 156 |
st.wHour, |
| 157 |
st.wMinute, |
| 158 |
st.wSecond |
| 159 |
); |
| 160 |
SendMessage(hStatus, SB_SETTEXT, |
| 161 |
(WPARAM)posFile | 0, (LPARAM)mes); |
| 162 |
if(logflag) log<<jikan<<" "<<mes<<endl;//if(*log!=NULL) * |
| 163 |
} |
| 164 |
|
| 165 |
void setstatus(int i) |
| 166 |
{ |
| 167 |
wsprintf(mes,"%d",i); |
| 168 |
setstatus(mes); |
| 169 |
} |
| 170 |
void setstatus(int i,int j) |
| 171 |
{ |
| 172 |
wsprintf(mes,"%d,%d",i,j); |
| 173 |
setstatus(mes); |
| 174 |
} |
| 175 |
|
| 176 |
void setstatus(int i,int j,int k) |
| 177 |
{ |
| 178 |
wsprintf(mes,"%d,%d,%d",i,j,k); |
| 179 |
setstatus(mes); |
| 180 |
} |
| 181 |
|
| 182 |
void logwrite(char *str, char *str2) |
| 183 |
{ |
| 184 |
if(logflag) log<<str<<","<<str2<<endl;//if(*log!=NULL) * |
| 185 |
} |
| 186 |
|
| 187 |
void logwrite(char *str) |
| 188 |
{ |
| 189 |
if(logflag) log<<str<<endl; |
| 190 |
} |
| 191 |
|
| 192 |
|
| 193 |
void logwrite(short i, short j) |
| 194 |
{ |
| 195 |
if(logflag) log<<i<<","<<j<<endl;//if(*log!=NULL) * |
| 196 |
} |
| 197 |
|
| 198 |
void setstatus(char *mes,char *m2) |
| 199 |
{ |
| 200 |
wsprintf(::mes,"%s %s", mes, m2); |
| 201 |
SendMessage(hStatus, SB_SETTEXT, |
| 202 |
(WPARAM)posFile | 0, (LPARAM)::mes); |
| 203 |
} |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
int Mes(char *m) |
| 208 |
{ |
| 209 |
return MessageBox(NULL, m, "!", MB_OKCANCEL); |
| 210 |
} |
| 211 |
int Mes(int i) |
| 212 |
{ |
| 213 |
char *buffer=mes; |
| 214 |
wsprintf(buffer,"%d",i); |
| 215 |
return MessageBox(NULL, buffer, "!", MB_OK); |
| 216 |
} |