Develop and Download Open Source Software

Browse CVS Repository

Contents of /enbanfukusyaya/EnbanKensa/macosx/MainWIndowControl.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Wed Dec 7 15:35:35 2005 UTC (18 years, 4 months ago) by bananajinn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +3 -2 lines
*** empty log message ***

1 /* ‰~”Ő•ĄŽĘ‰Ž - EnbanKensa
2 * Copyright (c) 2005 Kagetani Hideto
3 * MainWindowControl.m - Žĺ‘‹‘€ě
4 * $Date: 2005/05/29 17:12:23 $
5 * $Revision: 1.1 $
6 */
7 #define COCOA
8 #import "MainWIndowControl.h"
9 #import "SettingDialogControl.h"
10 #import "ui.h"
11 #import <scan.h>
12 #import <check.h>
13
14
15 @implementation MainWIndowControl
16
17 static NSImage *g_drawAreaImage=NULL;
18 static NSFont *g_font=NULL;
19 static SCAN_t *g_ReaderList=NULL;
20 static BOOL g_bRunningCheck=FALSE;
21 static UIWIDGETINFO g_widgetInfo;
22
23 - (IBAction)exitProgram:(id)sender
24 {
25 [NSApp terminate: self];
26 }
27
28 - (IBAction)scanDrive:(id)sender
29 {
30 int i;
31
32 g_ReaderList = ScanDrive(FALSE);
33
34 [drive removeAllItems];
35 for(i=0; strlen(g_ReaderList[i].inqdata)!=0; i++){
36 [drive addItemWithTitle: [NSString stringWithCString:
37 g_ReaderList[i].inqdata]];
38 }
39 if(i==0){
40 [buttonStart setEnabled: NO];
41 }
42 else{
43 [buttonStart setEnabled: YES];
44 }
45 }
46
47 - (IBAction)startCheck:(id)sender
48 {
49 if(g_bRunningCheck){
50 UISetAbort();
51 [buttonStart setEnabled: NO];
52 return;
53 }
54
55 int sel_drive;
56 DRIVEID drvid;
57 int ret;
58
59 /* ‘I‘đƒhƒ‰ƒCƒuŽć“ž */
60 sel_drive = [drive indexOfSelectedItem];
61
62 drvid.hid = g_ReaderList[sel_drive].hid;
63 drvid.tid = g_ReaderList[sel_drive].tid;
64
65 UIClearAbort();
66 g_bRunningCheck = TRUE;
67 [drive setEnabled: NO];
68 [buttonStart setTitle: [NSString stringWithCString: "’†’f"]];
69
70 ret = CheckDisc(&drvid);
71
72 [buttonStart setTitle: [NSString stringWithCString: "ŠJŽn"]];
73 [buttonStart setEnabled: YES];
74 [drive setEnabled: YES];
75 g_bRunningCheck = FALSE;
76 }
77
78 - (void)startUp
79 {
80 [self scanDrive: self];
81 NSRect rect = [drawArea bounds];
82 g_drawAreaImage = [[NSImage alloc]initWithSize: rect.size];
83 [drawArea setImage:g_drawAreaImage];
84 [g_drawAreaImage lockFocus];
85 [[NSColor blackColor] set];
86 NSRectFill(NSMakeRect(0, 0, rect.size.width, rect.size.height));
87 [g_drawAreaImage unlockFocus];
88 [drawArea setNeedsDisplay:YES];
89 g_font = [NSFont fontWithName:@"Osaka" size:16];
90 g_widgetInfo.label = infoMessage;
91 g_widgetInfo.view = drawArea;
92 g_widgetInfo.settingPanel = settingPanel;
93 g_widgetInfo.drawArea = g_drawAreaImage;
94 g_widgetInfo.font = g_font;
95 UISetWidgetInfo(&g_widgetInfo);
96 }
97
98
99 /*
100 * delegate
101 */
102 - (void) applicationDidFinishLaunching: (NSNotification *)aNotification
103 {
104 [self startUp];
105 }
106
107 - (void) applicationWillTerminate: (NSNotification *)aNotification
108 {
109 if(g_ReaderList!=NULL){
110 free(g_ReaderList);
111 g_ReaderList = NULL;
112 }
113 if(g_drawAreaImage!=NULL){
114 [g_drawAreaImage release];
115 g_drawAreaImage = NULL;
116 }
117 }
118
119 - (void)windowWillClose:(NSNotification *)aNotification
120 {
121 [NSApp terminate: self];
122 }
123
124 @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26