ARB
Classes | Macros | Enumerations | Functions | Variables
AWT_canio.cxx File Reference
#include "awt_canvas.hxx"
#include <aw_file.hxx>
#include <aw_awar.hxx>
#include <aw_msg.hxx>
#include <arb_progress.h>
#include <aw_root.hxx>
#include <arbdbt.h>
#include <arb_defs.h>
#include <arb_strbuf.h>
#include <arb_file.h>
Include dependency graph for AWT_canio.cxx:

Go to the source code of this file.

Classes

class  PaperFormat
 

Macros

#define awt_assert(cond)   arb_assert(cond)
 
#define AWAR_CANIO   "NT/print/"
 
#define AWAR_CANIO_LANDSCAPE   AWAR_CANIO "landscape"
 
#define AWAR_CANIO_CLIP   AWAR_CANIO "clip"
 
#define AWAR_CANIO_HANDLES   AWAR_CANIO "handles"
 
#define AWAR_CANIO_COLOR   AWAR_CANIO "color"
 
#define AWAR_CANIO_DEST   AWAR_CANIO "dest"
 
#define AWAR_CANIO_PRINTER   AWAR_CANIO "printer"
 
#define AWAR_CANIO_OVERLAP_WANTED   AWAR_CANIO "overlap"
 
#define AWAR_CANIO_OVERLAP_PERCENT   AWAR_CANIO "operc"
 
#define AWAR_CANIO_BORDERSIZE   AWAR_CANIO "border"
 
#define AWAR_CANIO_PAPER   AWAR_CANIO "paper"
 
#define AWAR_CANIO_PAPER_USABLE   AWAR_CANIO "useable"
 
#define AWAR_CANIO_F2DBUG   AWAR_CANIO "f2dbug"
 
#define AWAR_CANIO_PAGES   AWAR_CANIO "pages"
 
#define AWAR_CANIO_PAGELOCK   AWAR_CANIO "plock"
 
#define AWAR_CANIO_TMP   "tmp/" AWAR_CANIO
 
#define AWAR_CANIO_MAGNIFICATION   AWAR_CANIO_TMP "magnification"
 
#define AWAR_CANIO_OVERLAP   AWAR_CANIO_TMP "overlap"
 
#define AWAR_CANIO_GFX_SX   AWAR_CANIO_TMP "gsizex"
 
#define AWAR_CANIO_GFX_SY   AWAR_CANIO_TMP "gsizey"
 
#define AWAR_CANIO_OUT_SX   AWAR_CANIO_TMP "osizex"
 
#define AWAR_CANIO_OUT_SY   AWAR_CANIO_TMP "osizey"
 
#define AWAR_CANIO_PAPER_SX   AWAR_CANIO_TMP "psizex"
 
#define AWAR_CANIO_PAPER_SY   AWAR_CANIO_TMP "psizey"
 
#define AWAR_CANIO_PAGE_SX   AWAR_CANIO_TMP "sizex"
 
#define AWAR_CANIO_PAGE_SY   AWAR_CANIO_TMP "sizey"
 
#define AWAR_CANIO_FILE_BASE   AWAR_CANIO_TMP "file"
 
#define AWAR_CANIO_FILE_NAME   AWAR_CANIO_FILE_BASE "/file_name"
 
#define AWAR_CANIO_FILE_DIR   AWAR_CANIO_FILE_BASE "/directory"
 
#define AWAR_CANIO_FILE_FILTER   AWAR_CANIO_FILE_BASE "/filter"
 

Enumerations

enum  PrintDest { PDEST_PRINTER = 0, PDEST_POSTSCRIPT = 1, PDEST_PREVIEW = 2 }
 
enum  LengthUnit { INCH, MM }
 

Functions

float inch2mm (float inches)
 
float mm2inch (float mms)
 
static Rectangle get_drawsize (AWT_canvas *scr, bool draw_all)
 
static Rectangle add_border_to_drawsize (const Rectangle &drawsize, float border_percent)
 
static void awt_print_tree_check_size (UNFIXED, AWT_canvas *scr)
 
int xy2pages (float sx, float sy)
 
void set_paper_size_xy (AW_root *awr, float px, float py)
 
static void overlap_toggled_cb (AW_root *awr)
 
static long calc_mag_from_psize (AW_root *awr, float papersize, float gfxsize, float wantedpages, bool use_x)
 
static void set_mag_from_psize (AW_root *awr, bool use_x)
 
static void fit_pages (AW_root *awr, int wanted_pages, bool allow_orientation_change)
 
static void page_size_check_cb (AW_root *awr)
 
double round_psize (double psize)
 
static void paper_changed_cb (AW_root *awr)
 
static void create_fig_export_awars (AW_root *awr)
 
static void resetFiletype (AW_root *awr, const char *filter, const char *defaultFilename)
 
static void create_print_awars (AW_root *awr, AWT_canvas *scr)
 
static GB_ERROR canvas_to_xfig (AWT_canvas *scr, const char *xfig_name, bool add_invisibles, float border)
 
static void canvas_to_xfig_and_run_xfig (AW_window *aww, AWT_canvas *scr)
 
static void canvas_to_printer (AW_window *aww, AWT_canvas *scr)
 
void AWT_popup_tree_export_window (AW_window *parent_win, AWT_canvas *scr)
 
void AWT_popup_sec_export_window (AW_window *parent_win, AWT_canvas *scr)
 
static void columns_changed_cb (AW_window *aww)
 
static void rows_changed_cb (AW_window *aww)
 
static void fit_pages_cb (AW_window *aww, int wanted_pages)
 
void AWT_popup_print_window (AW_window *parent_win, AWT_canvas *scr)
 

Variables

static const float mm_per_inch = 25.4
 
static PaperFormat knownPaperFormat []
 
static bool allow_page_size_check_cb = true
 
static bool allow_overlap_toggled_cb = true
 
static bool export_awars_created = false
 
static bool print_awars_created = false
 

Macro Definition Documentation

#define awt_assert (   cond)    arb_assert(cond)

Definition at line 25 of file AWT_canio.cxx.

Referenced by canvas_to_printer(), canvas_to_xfig(), and PaperFormat::PaperFormat().

#define AWAR_CANIO   "NT/print/"

Definition at line 29 of file AWT_canio.cxx.

#define AWAR_CANIO_LANDSCAPE   AWAR_CANIO "landscape"
#define AWAR_CANIO_CLIP   AWAR_CANIO "clip"
#define AWAR_CANIO_HANDLES   AWAR_CANIO "handles"
#define AWAR_CANIO_COLOR   AWAR_CANIO "color"
#define AWAR_CANIO_DEST   AWAR_CANIO "dest"

Definition at line 34 of file AWT_canio.cxx.

Referenced by AWT_popup_print_window(), canvas_to_printer(), and create_print_awars().

#define AWAR_CANIO_PRINTER   AWAR_CANIO "printer"

Definition at line 35 of file AWT_canio.cxx.

Referenced by AWT_popup_print_window(), canvas_to_printer(), and create_print_awars().

#define AWAR_CANIO_OVERLAP_WANTED   AWAR_CANIO "overlap"
#define AWAR_CANIO_OVERLAP_PERCENT   AWAR_CANIO "operc"
#define AWAR_CANIO_BORDERSIZE   AWAR_CANIO "border"
#define AWAR_CANIO_PAPER   AWAR_CANIO "paper"
#define AWAR_CANIO_PAPER_USABLE   AWAR_CANIO "useable"

Definition at line 40 of file AWT_canio.cxx.

Referenced by AWT_popup_print_window(), create_print_awars(), and paper_changed_cb().

#define AWAR_CANIO_F2DBUG   AWAR_CANIO "f2dbug"
#define AWAR_CANIO_PAGES   AWAR_CANIO "pages"
#define AWAR_CANIO_PAGELOCK   AWAR_CANIO "plock"
#define AWAR_CANIO_TMP   "tmp/" AWAR_CANIO

Definition at line 45 of file AWT_canio.cxx.

#define AWAR_CANIO_MAGNIFICATION   AWAR_CANIO_TMP "magnification"
#define AWAR_CANIO_OVERLAP   AWAR_CANIO_TMP "overlap"
#define AWAR_CANIO_GFX_SX   AWAR_CANIO_TMP "gsizex"
#define AWAR_CANIO_GFX_SY   AWAR_CANIO_TMP "gsizey"
#define AWAR_CANIO_OUT_SX   AWAR_CANIO_TMP "osizex"

Definition at line 51 of file AWT_canio.cxx.

Referenced by AWT_popup_print_window(), create_print_awars(), and page_size_check_cb().

#define AWAR_CANIO_OUT_SY   AWAR_CANIO_TMP "osizey"

Definition at line 52 of file AWT_canio.cxx.

Referenced by AWT_popup_print_window(), create_print_awars(), and page_size_check_cb().

#define AWAR_CANIO_PAPER_SX   AWAR_CANIO_TMP "psizex"
#define AWAR_CANIO_PAPER_SY   AWAR_CANIO_TMP "psizey"
#define AWAR_CANIO_PAGE_SX   AWAR_CANIO_TMP "sizex"
#define AWAR_CANIO_PAGE_SY   AWAR_CANIO_TMP "sizey"
#define AWAR_CANIO_FILE_BASE   AWAR_CANIO_TMP "file"
#define AWAR_CANIO_FILE_NAME   AWAR_CANIO_FILE_BASE "/file_name"

Definition at line 59 of file AWT_canio.cxx.

Referenced by AWT_popup_print_window(), create_fig_export_awars(), and resetFiletype().

#define AWAR_CANIO_FILE_DIR   AWAR_CANIO_FILE_BASE "/directory"

Definition at line 60 of file AWT_canio.cxx.

Referenced by canvas_to_xfig_and_run_xfig(), and create_fig_export_awars().

#define AWAR_CANIO_FILE_FILTER   AWAR_CANIO_FILE_BASE "/filter"

Definition at line 61 of file AWT_canio.cxx.

Referenced by create_fig_export_awars(), and resetFiletype().

Enumeration Type Documentation

enum PrintDest
Enumerator
PDEST_PRINTER 
PDEST_POSTSCRIPT 
PDEST_PREVIEW 

Definition at line 65 of file AWT_canio.cxx.

enum LengthUnit
Enumerator
INCH 
MM 

Definition at line 73 of file AWT_canio.cxx.

Function Documentation

float inch2mm ( float  inches)
inline

Definition at line 76 of file AWT_canio.cxx.

References mm_per_inch.

float mm2inch ( float  mms)
inline

Definition at line 77 of file AWT_canio.cxx.

References mm_per_inch.

Referenced by PaperFormat::long_inch(), and PaperFormat::short_inch().

static Rectangle get_drawsize ( AWT_canvas scr,
bool  draw_all 
)
static
static Rectangle add_border_to_drawsize ( const Rectangle drawsize,
float  border_percent 
)
static
static void awt_print_tree_check_size ( UNFIXED  ,
AWT_canvas scr 
)
static
int xy2pages ( float  sx,
float  sy 
)
inline

Definition at line 189 of file AWT_canio.cxx.

Referenced by fit_pages(), and page_size_check_cb().

void set_paper_size_xy ( AW_root awr,
float  px,
float  py 
)
inline
static void overlap_toggled_cb ( AW_root awr)
static
static long calc_mag_from_psize ( AW_root awr,
float  papersize,
float  gfxsize,
float  wantedpages,
bool  use_x 
)
static
static void set_mag_from_psize ( AW_root awr,
bool  use_x 
)
static
static void fit_pages ( AW_root awr,
int  wanted_pages,
bool  allow_orientation_change 
)
static
static void page_size_check_cb ( AW_root awr)
static
double round_psize ( double  psize)
inline

Definition at line 412 of file AWT_canio.cxx.

References AW_INT.

static void paper_changed_cb ( AW_root awr)
static
static void create_fig_export_awars ( AW_root awr)
static
static void resetFiletype ( AW_root awr,
const char filter,
const char defaultFilename 
)
static
static void create_print_awars ( AW_root awr,
AWT_canvas scr 
)
static
static GB_ERROR canvas_to_xfig ( AWT_canvas scr,
const char xfig_name,
bool  add_invisibles,
float  border 
)
static
static void canvas_to_xfig_and_run_xfig ( AW_window aww,
AWT_canvas scr 
)
static
static void canvas_to_printer ( AW_window aww,
AWT_canvas scr 
)
static
void AWT_popup_tree_export_window ( AW_window parent_win,
AWT_canvas scr 
)
void AWT_popup_sec_export_window ( AW_window parent_win,
AWT_canvas scr 
)
static void columns_changed_cb ( AW_window aww)
static

Definition at line 852 of file AWT_canio.cxx.

References AW_window::get_root(), and set_mag_from_psize().

Referenced by AWT_popup_print_window().

static void rows_changed_cb ( AW_window aww)
static

Definition at line 853 of file AWT_canio.cxx.

References AW_window::get_root(), and set_mag_from_psize().

Referenced by AWT_popup_print_window().

static void fit_pages_cb ( AW_window aww,
int  wanted_pages 
)
static
void AWT_popup_print_window ( AW_window parent_win,
AWT_canvas scr 
)

Variable Documentation

const float mm_per_inch = 25.4
static

Definition at line 75 of file AWT_canio.cxx.

Referenced by inch2mm(), and mm2inch().

PaperFormat knownPaperFormat[]
static
Initial value:
= {
PaperFormat("A4", MM, 210, 297),
PaperFormat("A3", MM, 297, 420),
PaperFormat("A2", MM, 420, 594),
PaperFormat("A1", MM, 594, 841),
PaperFormat("A0", MM, 841, 1189),
PaperFormat("B5", MM, 182, 257),
PaperFormat("A (Letter)", "A", INCH, 8.5, 11),
PaperFormat("Legal", INCH, 11, 14),
PaperFormat("B (Ledger)", "B", INCH, 11, 17),
PaperFormat("C", "C", INCH, 17, 22),
PaperFormat("D", "D", INCH, 22, 34),
PaperFormat("E", "E", INCH, 34, 44),
}
Definition: AWT_canio.cxx:73

Definition at line 130 of file AWT_canio.cxx.

bool allow_page_size_check_cb = true
static

Definition at line 193 of file AWT_canio.cxx.

Referenced by page_size_check_cb(), and set_paper_size_xy().

bool allow_overlap_toggled_cb = true
static

Definition at line 194 of file AWT_canio.cxx.

Referenced by overlap_toggled_cb(), and page_size_check_cb().

bool export_awars_created = false
static

Definition at line 430 of file AWT_canio.cxx.

Referenced by create_fig_export_awars().

bool print_awars_created = false
static

Definition at line 431 of file AWT_canio.cxx.

Referenced by create_print_awars().