Ignore:
Timestamp:
2011-10-11T14:25:26+02:00 (13 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelCol.java

    r26720 r26830  
    4141                                if (button.isSelected()) {
    4242                                        if (dlg.mark != null) {
    43                                                 dlg.mark.setColour(ent, col);
    44                                                 if (ent != Ent.LIGHT) {
     43                                                if (ent == Ent.LIGHT) {
     44                                                        dlg.mark.setColour(ent, col);
     45                                                } else {
    4546                                                        if (button == offButton) {
    46                                                                 stack.remove(stackCol.get(stackIdx));
    47                                                                 stackCol.remove(stackIdx);
     47                                                                if (stackCol.size() != 0) {
     48                                                                        dlg.mark.subColour(ent, stackIdx);
     49                                                                        stackCol.get(stackIdx).removeActionListener(alStack);
     50                                                                        stackColours.remove(stackCol.get(stackIdx));
     51                                                                        stack.remove(stackCol.get(stackIdx));
     52                                                                        stackCol.remove(stackIdx);
     53                                                                        if ((stackCol.size() == stackIdx) && (stackIdx != 0))
     54                                                                                stackIdx--;
     55                                                                }
    4856                                                        } else if (button == addButton) {
    49                                                                 stackCol.add(stackIdx, new JRadioButton());
     57                                                                if (stackCol.size() != 0) stackIdx++;
     58                                                                dlg.mark.addColour(ent, stackIdx, col);
     59                                                                stackCol.add(stackIdx, new JRadioButton(new ImageIcon(getClass().getResource("/images/ColourButton.png"))));
    5060                                                                stackCol.get(stackIdx).setBorder(BorderFactory.createLineBorder(Color.magenta, 2));
    5161                                                                stack.add(stackCol.get(stackIdx));
     62                                                                stackColours.add(stackCol.get(stackIdx));
     63                                                                stackCol.get(stackIdx).addActionListener(alStack);
     64                                                        } else {
     65                                                                dlg.mark.setColour(ent, stackIdx, col);
    5266                                                        }
    53                                                         for (int i = 0; stackCol.size() > i; i++) {
    54                                                                 stackCol.get(i).setBounds(37, (89 + (i * (60 / stackCol.size()))), 30, (60 / stackCol.size()));
    55                                                                 stackCol.get(i).setBackground(dlg.mark.ColMAP.get(dlg.mark.getColour(ent, i)));
     67                                                        if (stackCol.size() != 0) {
     68                                                                int height = 60 / stackCol.size();
     69                                                                for (int i = 0; stackCol.size() > i; i++) {
     70                                                                        JRadioButton btnI = stackCol.get(i);
     71                                                                        btnI.setBounds(2, (2 + (i * height)), 30, height);
     72                                                                        btnI.setBackground(dlg.mark.ColMAP.get(dlg.mark.getColour(ent, i)));
     73                                                                        if (stackIdx == i) {
     74                                                                                btnI.setBorderPainted(true);
     75                                                                        } else {
     76                                                                                btnI.setBorderPainted(false);
     77                                                                        }
     78                                                                }
    5679                                                        }
    5780                                                }
     
    7497                                        stackIdx = i;
    7598                                        button.setBorderPainted(true);
    76                                 } else
     99                                } else {
    77100                                        button.setBorderPainted(false);
     101                                }
    78102                        }
    79103                }
     
    95119                this.add(getColButton(violetButton, 0, 128, 34, 16, Messages.getString("Violet"), Col.VIOLET), null);
    96120                if (ent != Ent.LIGHT) {
    97                         this.add(getColButton(addButton, 0, 144, 34, 16, Messages.getString("AddColour"), Col.UNKNOWN), null);
    98                         this.add(getColButton(blackButton, 35, 0, 34, 16, Messages.getString("Black"), Col.BLACK), null);
    99                         this.add(getColButton(greyButton, 35, 16, 34, 16, Messages.getString("Grey"), Col.GREY), null);
    100                         this.add(getColButton(brownButton, 35, 32, 34, 16, Messages.getString("Brown"), Col.BROWN), null);
    101                         this.add(getColButton(magentaButton, 35, 48, 34, 16, Messages.getString("Magenta"), Col.MAGENTA), null);
    102                         this.add(getColButton(pinkButton, 35, 64, 34, 16, Messages.getString("Pink"), Col.PINK), null);
     121                        this.add(getColButton(addButton, 0, 144, 34, 16, Messages.getString("AddColour"), Col.BLANK), null);
     122                        this.add(getColButton(blackButton, 37, 0, 34, 16, Messages.getString("Black"), Col.BLACK), null);
     123                        this.add(getColButton(greyButton, 37, 16, 34, 16, Messages.getString("Grey"), Col.GREY), null);
     124                        this.add(getColButton(brownButton, 37, 32, 34, 16, Messages.getString("Brown"), Col.BROWN), null);
     125                        this.add(getColButton(magentaButton, 37, 48, 34, 16, Messages.getString("Magenta"), Col.MAGENTA), null);
     126                        this.add(getColButton(pinkButton, 37, 64, 34, 16, Messages.getString("Pink"), Col.PINK), null);
    103127
    104128                        stack = new JPanel();
    105129                        stack.setBorder(BorderFactory.createLineBorder(Color.black));
    106                         stack.setBounds(37, 89, 30, 60);
     130                        stack.setBounds(38, 87, 34, 64);
     131                        stack.setLayout(null);
    107132                        this.add(stack);
    108133                        if (dlg.mark != null) {
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMore.java

    r26631 r26830  
    2121                this.setLayout(null);
    2222                panelPat = new PanelPat(dlg);
    23                 panelPat.setBounds(new Rectangle(0, 0, 100, 160));
     23                panelPat.setBounds(new Rectangle(0, 0, 110, 160));
    2424                this.add(panelPat, null);
    2525
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPat.java

    r26713 r26830  
    4545                this.setLayout(null);
    4646                panelCol = new PanelCol(dlg, alType, Ent.BODY);
    47                 panelCol.setBounds(new Rectangle(0, 0, 68, 160));
     47                panelCol.setBounds(new Rectangle(0, 0, 72, 160));
    4848                this.add(panelCol, null);
    49                 this.add(getPatButton(noneButton, 72, 0, 27, 27, "NoPat", Pat.NONE), null);
    50                 this.add(getPatButton(horizButton, 72, 26, 27, 27, "HorizPat", Pat.HORIZ), null);
    51                 this.add(getPatButton(vertButton, 72, 52, 27, 27, "VertPat", Pat.VERT), null);
    52                 this.add(getPatButton(diagButton, 72, 78, 27, 27, "DiagPat", Pat.DIAG), null);
    53                 this.add(getPatButton(squareButton, 72, 104, 27, 27, "SquarePat", Pat.SQUARE), null);
    54                 this.add(getPatButton(borderButton, 72, 130, 27, 27, "BorderPat", Pat.BORDER), null);
     49                this.add(getPatButton(noneButton, 76, 0, 27, 27, "NoPat", Pat.NONE), null);
     50                this.add(getPatButton(horizButton, 76, 26, 27, 27, "HorizPat", Pat.HORIZ), null);
     51                this.add(getPatButton(vertButton, 76, 52, 27, 27, "VertPat", Pat.VERT), null);
     52                this.add(getPatButton(diagButton, 76, 78, 27, 27, "DiagPat", Pat.DIAG), null);
     53                this.add(getPatButton(squareButton, 76, 104, 27, 27, "SquarePat", Pat.SQUARE), null);
     54                this.add(getPatButton(borderButton, 76, 130, 27, 27, "BorderPat", Pat.BORDER), null);
    5555               
    5656        }
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java

    r26713 r26830  
    257257
    258258        public enum Col {
    259                 UNKNOWN, WHITE, RED, ORANGE, AMBER, YELLOW, GREEN, BLUE, VIOLET, BLACK, GREY, BROWN, MAGENTA, PINK
     259                UNKNOWN, BLANK, WHITE, RED, ORANGE, AMBER, YELLOW, GREEN, BLUE, VIOLET, BLACK, GREY, BROWN, MAGENTA, PINK
    260260        }
    261261
     
    364364                case LIGHT:
    365365                        lightColour.set(i, col);
     366                        break;
     367                }
     368        }
     369
     370        public void addColour(Ent ent, int i, Col col) {
     371                switch (ent) {
     372                case BODY:
     373                case BUOY:
     374                case BEACON:
     375                case FLOAT:
     376                        bodyColour.add(i, col);
     377                        break;
     378                case TOPMARK:
     379                        topColour.add(i, col);
     380                        break;
     381                case DAYMARK:
     382                        dayColour.add(i, col);
     383                        break;
     384                case LIGHT:
     385                        lightColour.add(i, col);
    366386                        break;
    367387                }
Note: See TracChangeset for help on using the changeset viewer.