// Path: src/ch/jbead/Localization.java
// public interface Localization {
// 
//     public ResourceBundle getBundle();
//     public String getString(String key);
//     public int getMnemonic(String key);
//     public KeyStroke getKeyStroke(String key);
// 
// }
// 
// Path: src/ch/jbead/View.java
// public interface View {
// 
//     public void addListener(ViewListener listener);
// 
//     public boolean drawColors();
//     public boolean drawSymbols();
// 
//     public boolean isDraftVisible();
//     public boolean isCorrectedVisible();
//     public boolean isSimulationVisible();
//     public boolean isReportVisible();
// 
//     public String getSelectedTool();
//     public boolean isDragging();
//     public void setDragging(boolean dragging);
//     public Selection getSelection();
//     public void selectColor(byte colorIndex);
// 
//     public void refresh();
// }


import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.List;
import ch.jbead.Localization;
import ch.jbead.Model;
import ch.jbead.View;
import ch.jbead.util.Convert;
/** jbead - http://www.jbead.ch
    Copyright (C) 2001-2012  Damian Brunold

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package ch.jbead.print;



public abstract class GridPrinter extends PartPrinter {

    protected int gx = Convert.mmToPoint(3);
    protected int gy = gx;
    protected boolean fullPattern;

    public GridPrinter(Model model, View view, Localization localization, boolean fullPattern) {
        super(model, view, localization);
        this.fullPattern = fullPattern;
    }

    @Override
    public List<Integer> layoutColumns(int width, int height) {
        List<Integer> columns = new ArrayList<Integer>();
        int rows = getRows(height);
        int rowsPerColumn = getRowsPerColumn(height);
        int cols = (rows + rowsPerColumn - 1) / rowsPerColumn;
        if (cols > 0) {
            int colwidth = getColumnWidth() + 2 * border;
            for (int i = 0; i < cols; i++) {
                columns.add(colwidth);
            }
        }
        return columns;
    }

// Path: src/ch/jbead/Localization.java
// public interface Localization {
// 
//     public ResourceBundle getBundle();
//     public String getString(String key);
//     public int getMnemonic(String key);
//     public KeyStroke getKeyStroke(String key);
// 
// }
// 
// Path: src/ch/jbead/View.java
// public interface View {
// 
//     public void addListener(ViewListener listener);
// 
//     public boolean drawColors();
//     public boolean drawSymbols();
// 
//     public boolean isDraftVisible();
//     public boolean isCorrectedVisible();
//     public boolean isSimulationVisible();
//     public boolean isReportVisible();
// 
//     public String getSelectedTool();
//     public boolean isDragging();
//     public void setDragging(boolean dragging);
//     public Selection getSelection();
//     public void selectColor(byte colorIndex);
// 
//     public void refresh();
// }


// Path: src/ch/jbead/print/GridPrinter.java
import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.List;
import ch.jbead.Localization;
import ch.jbead.Model;
import ch.jbead.View;
import ch.jbead.util.Convert;

/** jbead - http://www.jbead.ch
    Copyright (C) 2001-2012  Damian Brunold

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package ch.jbead.print;



public abstract class GridPrinter extends PartPrinter {

    protected int gx = Convert.mmToPoint(3);
    protected int gy = gx;
    protected boolean fullPattern;

    public GridPrinter(Model model, View view, Localization localization, boolean fullPattern) {
        super(model, view, localization);
        this.fullPattern = fullPattern;
    }

    @Override
    public List<Integer> layoutColumns(int width, int height) {
        List<Integer> columns = new ArrayList<Integer>();
        int rows = getRows(height);
        int rowsPerColumn = getRowsPerColumn(height);
        int cols = (rows + rowsPerColumn - 1) / rowsPerColumn;
        if (cols > 0) {
            int colwidth = getColumnWidth() + 2 * border;
            for (int i = 0; i < cols; i++) {
                columns.add(colwidth);
            }
        }
        return columns;
    }

    protected int getRowsPerColumn(int height) {