File: DigitSource.m.rej

package info (click to toggle)
sudoku.app 0.7-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 196 kB
  • sloc: objc: 1,728; makefile: 9
file content (192 lines) | stat: -rw-r--r-- 5,015 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
@@ -42,9 +42,11 @@
 
 + (NSPanel *)prog_ind
 {
-    if(_prog_ind_panel==nil){
+    if(_prog_ind_panel==nil)
+      {
 	NSRect pi_frame =
 	    NSMakeRect(0, 0, PROG_IND_WIDTH, PROG_IND_HEIGHT);
+	KnobView *_prog_ind;
 
         _prog_ind_panel = 
             [[NSPanel alloc]
@@ -54,8 +56,7 @@
                 defer:NO];
         [_prog_ind_panel setReleasedWhenClosed:NO];
         
-	KnobView *_prog_ind =
-	    [[KnobView alloc] initWithFrame:pi_frame];
+	_prog_ind = [[KnobView alloc] initWithFrame:pi_frame];
         [_prog_ind_panel setContentView:_prog_ind];
 
 	[_prog_ind_panel setTitle:_(@"Computing Sudoku")];
@@ -80,28 +81,31 @@
 - newPuzzle:(id)sender; // clues = [sender tag]
 {
     NSApplication *app = [NSApplication sharedApplication];
-
-    NSDocumentController *dc =
-	[NSDocumentController sharedDocumentController];
-    [dc newDocument:self];
-
-    Document *doc = [dc currentDocument];
-    Sudoku *sdk = [doc sudoku];
-
+    NSModalSession findSession;
+    NSDocumentController *dc = [NSDocumentController sharedDocumentController];
+    Document *doc;
+    Sudoku *sdk;
     NSPanel *pi_panel = [Controller prog_ind];
     KnobView *pi = [pi_panel contentView];
-    
+    float percent = 0, dir = 1;
+    STATE st = STATE_FIND;
+    NSString *checkseq = nil; 
+    Sudoku *other, *pick;
+    int tries;
+
+    doc = [dc currentDocument];
+    sdk = [doc sudoku];
+    [dc newDocument:self];
     [pi_panel makeKeyAndOrderFront:self];
 
-    NSModalSession findSession;
+    
     findSession = [app beginModalSessionForWindow:pi_panel];
 
-    float percent = 0, dir = 1;
-    STATE st = STATE_FIND;
 
-    NSString *checkseq = nil; 
-    Sudoku *other = [[Sudoku alloc] init], *pick = [[Sudoku alloc] init];
-    int tries = 0;
+    
+    other = [[Sudoku alloc] init];
+    pick = [[Sudoku alloc] init];
+    tries = 0;
 
     do {
 	int tick;
@@ -184,12 +188,14 @@
 - makeInputPanel
 {
   int m = NSTitledWindowMask;
-
-  NSRect frame = 
-      {{ 0, BUTTON_HEIGHT + DIGIT_FIELD_DIM},  { SDK_DIM, SDK_DIM} };
+  int x;
+  float margin;
+  NSButton *button;
+  NSRect allframe ;
+  NSRect frame = {{ 0, BUTTON_HEIGHT + DIGIT_FIELD_DIM},  { SDK_DIM, SDK_DIM} };
   sdkview  = [[SudokuView alloc] initWithFrame:frame];
 
-  NSRect allframe = frame;
+  allframe = frame;
   allframe.size.height += BUTTON_HEIGHT + DIGIT_FIELD_DIM;
 
   enterPanel = 
@@ -202,10 +208,9 @@
 
   [[enterPanel contentView] addSubview:sdkview];
 
-  float margin = (SDK_DIM - DIGIT_FIELD_DIM*10)/2;
+  margin = (SDK_DIM - DIGIT_FIELD_DIM*10)/2;
   assert(margin>0);
 
-  int x;
   for(x=1; x<=10; x++){
       DigitSource *dgs =
 	[[DigitSource alloc] 
@@ -216,13 +221,12 @@
   }
 
 
-  NSButton *button = [NSButton new];
+  button = [NSButton new];
   [button setTitle:_(@"Enter")];
   [button setTarget:self];
   [button setAction:@selector(actionEnter:)];
 
-  [button 
-      setFrame:NSMakeRect(0, 0, SDK_DIM/3, BUTTON_HEIGHT)];
+  [button setFrame:NSMakeRect(0, 0, SDK_DIM/3, BUTTON_HEIGHT)];
   
   [[enterPanel contentView] addSubview:button];
 
@@ -231,8 +235,7 @@
   [button setTarget:self];
   [button setAction:@selector(actionReset:)];
 
-  [button 
-      setFrame:NSMakeRect(SDK_DIM/3, 0, SDK_DIM/3, BUTTON_HEIGHT)];
+  [button setFrame:NSMakeRect(SDK_DIM/3, 0, SDK_DIM/3, BUTTON_HEIGHT)];
   
   [[enterPanel contentView] addSubview:button];
 
@@ -241,8 +244,7 @@
   [button setTarget:self];
   [button setAction:@selector(actionCancel:)];
 
-  [button 
-      setFrame:NSMakeRect(2*SDK_DIM/3, 0, SDK_DIM/3, BUTTON_HEIGHT)];
+  [button setFrame:NSMakeRect(2*SDK_DIM/3, 0, SDK_DIM/3, BUTTON_HEIGHT)];
   
   [[enterPanel contentView] addSubview:button];
 
@@ -260,9 +262,13 @@
   Document *doc;
   Sudoku *sdk;
   Sudoku *user;
+  NSPanel *pi_panel;
+  KnobView *pi;
+  NSModalSession solveSession;
+  float percent, dir;
+  NSDate *end;
 
-    [[NSApplication sharedApplication]
-        stopModal];
+    [[NSApplication sharedApplication] stopModal];
     [enterPanel orderOut:self];
 
     [palette orderFront:self];
@@ -278,17 +284,17 @@
     [sdk guessToClues];
     // [sdk cluesToPuzzle];
 
-    NSPanel *pi_panel = [Controller prog_ind];
-    KnobView *pi = [pi_panel contentView];
+    pi_panel = [Controller prog_ind];
+    pi = [pi_panel contentView];
     
     [pi_panel makeKeyAndOrderFront:self];
 
-    NSModalSession solveSession;
     solveSession = [[NSApplication sharedApplication] beginModalSessionForWindow:pi_panel];
 
-    float percent = 0, dir = 1;
+    percent = 0;
+    dir = 1;
 
-    NSDate *end = [NSDate dateWithTimeIntervalSinceNow:MAX_SOLVE_SECS];
+    end = [NSDate dateWithTimeIntervalSinceNow:MAX_SOLVE_SECS];
 
     success = NO;
     do {
@@ -407,6 +413,7 @@
 
 - makeDigitPalette
 {
+  int x, y;
   NSRect pbounds = 
     NSMakeRect(0, 0, 2*DIGIT_FIELD_DIM, 5*DIGIT_FIELD_DIM);
 
@@ -431,7 +438,6 @@
   [palette setFrameAutosaveName: @"SudokuDigitPalette"];
 
 
-  int x, y;
   for(x=0; x<2; x++){
     for(y=0; y<5; y++){
       DigitSource *dgs =