# HG changeset patch # User Claus Gittinger # Date 921232655 -3600 # Node ID 31097504a15a42d8e565ac1e2af41805fea3df5a # Parent 2b65eda2938e070d5aae6f5b4d6e497479a7a479 fixed startup (modal box in calling thread, instead of imageEditor thread). Prepared addColor menu item (not yet finished) diff -r 2b65eda2938e -r 31097504a15a ImageEditor.st --- a/ImageEditor.st Wed Mar 10 01:51:08 1999 +0100 +++ b/ImageEditor.st Fri Mar 12 10:57:35 1999 +0100 @@ -102,7 +102,14 @@ self openOnImage: Icon startIcon " - ^self open loadFromImage: anImage + |editor| + + editor := self new. + editor allButOpen. + editor loadFromImage: anImage. + editor openWindow + + "Modified: / 11.3.1999 / 16:18:33 / cg" ! ! !ImageEditor class methodsFor:'accessing'! @@ -592,13 +599,16 @@ #window: #(#WindowSpec #name: 'Image Editor' - #layout: #(#LayoutFrame 176 0 156 0 675 0 501 0) + #layout: #(#LayoutFrame 507 0 28 0 1004 0 371 0) + #level: 0 #label: 'Image Editor' #min: #(#Point 400 320) #max: #(#Point 1152 900) - #bounds: #(#Rectangle 176 156 676 502) + #bounds: #(#Rectangle 507 28 1005 372) #menu: #menu #usePreferredExtent: false + #returnIsOKInDialog: true + #escapeIsCancelInDialog: true ) #component: #(#SpecCollection @@ -647,6 +657,7 @@ #layout: #(#LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0) #activeHelpKey: #colorMapTable #model: #selectionOfColor + #menu: #colorMapMenu #style: #(#FontDescription #helvetica #medium #roman 10) #hasHorizontalScrollBar: true #hasVerticalScrollBar: true @@ -717,6 +728,7 @@ ) #(#ViewSpec #name: 'view2' + #level: -1 #component: #(#SpecCollection #collection: @@ -732,10 +744,10 @@ #(#LabelSpec #name: 'coordLabel' #layout: #(#LayoutFrame 2 0.0 -22 1 -83 1.0 0 1.0) + #level: -1 #labelChannel: #imageInfoHolder - #level: -1 + #resizeForLabel: false #adjust: #left - #resizeForLabel: false ) #(#ArrowButtonSpec #name: 'magnifyDownButton' @@ -770,7 +782,6 @@ ) ) ) - #level: -1 ) ) ) @@ -786,11 +797,42 @@ ) ) - "Modified: / 7.8.1998 / 22:52:28 / cg" + "Modified: / 12.3.1999 / 00:15:05 / cg" ! ! !ImageEditor class methodsFor:'menu specs'! +colorMapMenu + "This resource specification was automatically generated + by the MenuEditor of ST/X." + + "Do not manually edit this!! If it is corrupted, + the MenuEditor may not be able to read the specification." + + " + MenuEditor new openOnClass:ImageEditor andSelector:#menuSpec + (Menu new fromLiteralArrayEncoding:(ImageEditor menuSpec)) startUp + " + + + + ^ + + #(#Menu + + #( + #(#MenuItem + #label: 'Add Color' + #translateLabel: true + #value: #addColorToColormap + ) + ) nil + nil + ) + + "Created: / 12.3.1999 / 00:19:00 / cg" +! + menu "This resource specification was automatically generated by the MenuEditor of ST/X." @@ -1865,6 +1907,31 @@ !ImageEditor methodsFor:'user actions - colormap'! +addColorToColormap + |d img cMap newCMap| + + img := self image. + d := img depth. + cMap := img colorMap. + ((d == 1) + or:[cMap size == (1 bitShift:d)]) ifTrue:[ + d >= 8 ifTrue:[ + self warn:'No space for more colors in colormap.'. + ^ self + ]. + (self confirm:'No space for more colors in colormap.\Change depth ?' withCRs) + ifFalse:[ + ^ self + ] + ]. + newCMap := cMap asArray copyWith:(Color black). + img colorMap:newCMap. + self listOfColors contents: newCMap. + + "Created: / 12.3.1999 / 00:20:28 / cg" + "Modified: / 12.3.1999 / 02:09:01 / cg" +! + colorMapChanged |img| @@ -1893,7 +1960,7 @@ self withExecuteCursorDo:[ oldImage := self image. - prevMode := colorMapMode. + prevMode := colorMapMode value. oldImage depth > 8 ifTrue:[ prevMode := nil ]. @@ -2066,7 +2133,7 @@ ] ] - "Modified: / 30.9.1998 / 23:44:19 / cg" + "Modified: / 11.3.1999 / 16:20:09 / cg" ! compressColorMap