plot-lab 0.0.1.6 → 0.0.1.7
raw patch · 9 files changed
+537/−2027 lines, 9 files
Files
- Main.hs +0/−9
- button-panel.glade +0/−1023
- main-window.glade +0/−34
- plot-lab.cabal +8/−2
- plot-window.glade +0/−959
- src/Main.hs +9/−0
- src/PlotLab/Events.hs +195/−0
- src/PlotLab/FigureSettings.hs +50/−0
- src/PlotLab/Main.hs +275/−0
− Main.hs
@@ -1,9 +0,0 @@-module Main where--import qualified PlotLab.Main-import Paths_plot_lab (getDataFileName)--main = do- mainGlade <- getDataFileName "main-window.glade"- plotGlade <- getDataFileName "plot-window.glade"- PlotLab.Main.main mainGlade plotGlade
− button-panel.glade
@@ -1,1023 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<interface>- <requires lib="gtk+" version="2.24"/>- <!-- interface-naming-policy project-wide -->- <object class="GtkTable" id="Button Panel">- <property name="width_request">600</property>- <property name="height_request">300</property>- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="n_rows">5</property>- <property name="n_columns">10</property>- <property name="homogeneous">True</property>- <child>- <object class="GtkButton" id="calc_inverse_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- <child internal-child="accessible">- <object class="AtkObject" id="calc_inverse_button-atkobject">- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the inverse button">Inverse</property>- </object>- </child>- <child>- <object class="GtkLabel" id="label20">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label"><i>x</i><sup>−1</sup></property>- <property name="use_markup">True</property>- <property name="justify">center</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">6</property>- <property name="right_attach">7</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_factor_button">- <property name="label">a×b</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- <child internal-child="accessible">- <object class="AtkObject" id="calc_factor_button-atkobject">- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the factorize button">Factorize</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">5</property>- <property name="right_attach">6</property>- <property name="top_attach">4</property>- <property name="bottom_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_factorial_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- <child internal-child="accessible">- <object class="AtkObject" id="calc_factorial_button-atkobject">- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the factorial button">Factorial</property>- </object>- </child>- <child>- <object class="GtkLabel" id="label14">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label"><i>x</i>!</property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">7</property>- <property name="right_attach">8</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_imaginary_portion_button">- <property name="label">Im</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">7</property>- <property name="right_attach">8</property>- <property name="top_attach">4</property>- <property name="bottom_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_imaginary_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- <child>- <object class="GtkLabel" id="imaginary_label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label"><i>i</i></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="top_attach">4</property>- <property name="bottom_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_4_button">- <property name="label">4</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_7_button">- <property name="label">7</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_8_button">- <property name="label">8</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_9_button">- <property name="label">9</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_5_button">- <property name="label">5</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_6_button">- <property name="label">6</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_divide_button">- <property name="label">÷</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">3</property>- <property name="right_attach">4</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_1_button">- <property name="label">1</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="top_attach">3</property>- <property name="bottom_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_2_button">- <property name="label">2</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">3</property>- <property name="bottom_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_0_button">- <property name="label">0</property>- <property name="width_request">50</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="top_attach">4</property>- <property name="bottom_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_numeric_point_button">- <property name="label" comments="Label is set in gtk.c to comply with LC flags">.</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">4</property>- <property name="bottom_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_3_button">- <property name="label">3</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="top_attach">3</property>- <property name="bottom_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_multiply_button">- <property name="label">×</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">3</property>- <property name="right_attach">4</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_subtract_button">- <property name="label">−</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">3</property>- <property name="right_attach">4</property>- <property name="top_attach">3</property>- <property name="bottom_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_add_button">- <property name="label">+</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">3</property>- <property name="right_attach">4</property>- <property name="top_attach">4</property>- <property name="bottom_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_result_button">- <property name="label" translatable="yes" comments="Label on the solve button (clicking this solves the displayed calculation)">=</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">4</property>- <property name="right_attach">5</property>- <property name="top_attach">4</property>- <property name="bottom_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_clear_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- <child>- <object class="GtkImage" id="image1">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="icon_name">edit-clear-symbolic</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">5</property>- <property name="right_attach">6</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkToggleButton" id="calc_subscript_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- <child internal-child="accessible">- <object class="AtkObject" id="calc_subscript_button-atkobject">- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the subscript mode button">Subscript</property>- </object>- </child>- <child>- <object class="GtkLabel" id="label4">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label">↓n</property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkToggleButton" id="calc_superscript_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- <child internal-child="accessible">- <object class="AtkObject" id="calc_superscript_button-atkobject">- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the superscript mode button">Superscript</property>- </object>- </child>- <child>- <object class="GtkLabel" id="label3">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label">↑n</property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_exponential_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- <child internal-child="accessible">- <object class="AtkObject" id="calc_exponential_button-atkobject">- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the scientific exponent button">Scientific Exponent</property>- </object>- </child>- <child>- <object class="GtkLabel" id="label2">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label">×10<sup><i>y</i></sup></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_modulus_divide_button">- <property name="label">mod</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">3</property>- <property name="right_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_start_group_button">- <property name="label">(</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">4</property>- <property name="right_attach">5</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_end_group_button">- <property name="label">)</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">5</property>- <property name="right_attach">6</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_memory_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- <child internal-child="accessible">- <object class="AtkObject" id="calc_memory_button-atkobject">- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the memory button">Memory</property>- </object>- </child>- <child>- <object class="GtkHBox" id="hbox20">- <property name="visible">True</property>- <property name="can_focus">False</property>- <child>- <object class="GtkLabel" id="label23">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes" comments="The label on the memory button">x</property>- <attributes>- <attribute name="style" value="italic"/>- </attributes>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkArrow" id="arrow14">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="arrow_type">down</property>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- </child>- </object>- <packing>- <property name="left_attach">4</property>- <property name="right_attach">6</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_abs_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- <child internal-child="accessible">- <object class="AtkObject" id="calc_abs_button-atkobject">- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the absolute value button">Absolute Value</property>- </object>- </child>- <child>- <object class="GtkLabel" id="label1">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label">|<i>x</i>|</property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">8</property>- <property name="right_attach">9</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_real_portion_button">- <property name="label">Re</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">6</property>- <property name="right_attach">7</property>- <property name="top_attach">4</property>- <property name="bottom_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_conjugate_button">- <property name="label">conj</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">8</property>- <property name="right_attach">9</property>- <property name="top_attach">4</property>- <property name="bottom_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_arg_button">- <property name="label">Arg</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">9</property>- <property name="right_attach">10</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_natural_logarithm_button">- <property name="label">ln</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">9</property>- <property name="right_attach">10</property>- <property name="top_attach">3</property>- <property name="bottom_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_logarithm_button">- <property name="label">log</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">8</property>- <property name="right_attach">9</property>- <property name="top_attach">3</property>- <property name="bottom_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_x_pow_y_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- <child internal-child="accessible">- <object class="AtkObject" id="calc_x_pow_y_button-atkobject">- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the exponentiation (x to the power of y) button">Exponent</property>- </object>- </child>- <child>- <object class="GtkLabel" id="x_pow_y_label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label"><i>x</i><sup><i>y</i></sup></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">6</property>- <property name="right_attach">7</property>- <property name="top_attach">3</property>- <property name="bottom_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_root_button">- <property name="label">√</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">7</property>- <property name="right_attach">8</property>- <property name="top_attach">3</property>- <property name="bottom_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_undo_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- <child>- <object class="GtkImage" id="image2">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="icon_name">edit-undo-symbolic</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">4</property>- <property name="right_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_pi_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- <child>- <object class="GtkLabel" id="pi_label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label">π</property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">4</property>- <property name="right_attach">5</property>- <property name="top_attach">3</property>- <property name="bottom_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_eulers_number_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="use_underline">True</property>- <property name="focus_on_click">False</property>- <child>- <object class="GtkLabel" id="eulers_number_label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label"><i>e</i></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="left_attach">5</property>- <property name="right_attach">6</property>- <property name="top_attach">3</property>- <property name="bottom_attach">4</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkTable" id="table1">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="n_rows">2</property>- <property name="n_columns">3</property>- <property name="homogeneous">True</property>- <child>- <object class="GtkButton" id="calc_cosine_button">- <property name="label">cos</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_sine_button">- <property name="label">sin</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_tangent_button">- <property name="label">tan</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_hyperbolic_cosine_button">- <property name="label">cosh</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_hyperbolic_sine_button">- <property name="label">sinh</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_hyperbolic_tangent_button">- <property name="label">tanh</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- </object>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- </object>- <packing>- <property name="left_attach">6</property>- <property name="right_attach">10</property>- <property name="bottom_attach">2</property>- </packing>- </child>- <child>- <object class="GtkButton" id="calc_function_button">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- <property name="focus_on_click">False</property>- <child internal-child="accessible">- <object class="AtkObject" id="calc_function_button-atkobject">- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the store value button">Store</property>- </object>- </child>- <child>- <object class="GtkHBox" id="hbox2">- <property name="visible">True</property>- <property name="can_focus">False</property>- <child>- <object class="GtkLabel" id="label5">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label">f(x)</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkArrow" id="arrow1">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="arrow_type">down</property>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- </child>- </object>- <packing>- <property name="left_attach">9</property>- <property name="right_attach">10</property>- <property name="top_attach">4</property>- <property name="bottom_attach">5</property>- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>- </packing>- </child>- </object>-</interface>
− main-window.glade
@@ -1,34 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<interface>- <requires lib="gtk+" version="2.24"/>- <!-- interface-naming-policy project-wide -->- <object class="GtkWindow" id="Main Window">- <property name="can_focus">False</property>- <property name="title" translatable="yes">Plot Lab</property>- <property name="resizable">False</property>- <child>- <object class="GtkVBox" id="Working Area">- <property name="visible">True</property>- <property name="can_focus">False</property>- <child>- <placeholder/>- </child>- <child>- <object class="GtkButton" id="Plot Button">- <property name="label" translatable="yes">Plot</property>- <property name="width_request">250</property>- <property name="height_request">75</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">False</property>- <property name="position">1</property>- </packing>- </child>- </object>- </child>- </object>-</interface>
plot-lab.cabal view
@@ -1,5 +1,5 @@ Name: plot-lab-Version: 0.0.1.6+Version: 0.0.1.7 License: GPL-2 License-file: LICENSE Author: Sumit Sahrawat@@ -18,7 +18,7 @@ Build-type: Simple Extra-source-files: README.md-Data-files: button-panel.glade, main-window.glade, plot-window.glade+Data-dir: ui executable plot-lab Main-is: Main.hs@@ -28,6 +28,12 @@ , gtk >=0.13 && <0.14 , hmatrix >=0.16 && <0.17 , text >=1.2 && <1.3++ hs-source-dirs: src+ other-modules: Paths_plot_lab+ , PlotLab.Events+ , PlotLab.FigureSettings+ , PlotLab.Main -- ghc-options: -O2 default-language: Haskell2010
− plot-window.glade
@@ -1,959 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<interface>- <requires lib="gtk+" version="2.24"/>- <!-- interface-naming-policy project-wide -->- <object class="GtkAdjustment" id="Export Height">- <property name="lower">1</property>- <property name="upper">5120</property>- <property name="value">1</property>- <property name="step_increment">50</property>- <property name="page_increment">200</property>- </object>- <object class="GtkAdjustment" id="Export Width">- <property name="lower">1</property>- <property name="upper">5120</property>- <property name="value">1</property>- <property name="step_increment">50</property>- <property name="page_increment">200</property>- </object>- <object class="GtkWindow" id="Plot Window">- <property name="can_focus">False</property>- <property name="border_width">1</property>- <property name="title" translatable="yes">Your Plot</property>- <child>- <object class="GtkHBox" id="Vertical Division">- <property name="visible">True</property>- <property name="can_focus">False</property>- <child>- <object class="GtkVBox" id="Plot Region">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">5</property>- <child>- <object class="GtkAspectFrame" id="Canvas Aspect">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label_xalign">0</property>- <property name="shadow_type">in</property>- <child>- <object class="GtkDrawingArea" id="Plotting Canvas">- <property name="width_request">500</property>- <property name="height_request">500</property>- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="events">GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK</property>- </object>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="pack_type">end</property>- <property name="position">0</property>- </packing>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkVSeparator" id="Separator">- <property name="visible">True</property>- <property name="can_focus">False</property>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- <child>- <object class="GtkScrolledWindow" id="Settings Palette Scroll">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="hscrollbar_policy">never</property>- <property name="vscrollbar_policy">automatic</property>- <child>- <object class="GtkViewport" id="Settings Palette Viewport">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="shadow_type">none</property>- <child>- <object class="GtkVBox" id="Settings Palette">- <property name="width_request">250</property>- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">10</property>- <child>- <object class="GtkFrame" id="Plot Title">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <property name="label_xalign">0</property>- <property name="shadow_type">in</property>- <child>- <object class="GtkHBox" id="Plot Title Input Widget">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <property name="spacing">2</property>- <child>- <object class="GtkEntry" id="Plot Title Entry">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="invisible_char_set">True</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkSpinButton" id="Plot Title Size">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">0.5</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">Title Font Size</property>- <property name="digits">1</property>- <property name="snap_to_ticks">True</property>- <property name="numeric">True</property>- <property name="update_policy">if-valid</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- </child>- <child type="label">- <object class="GtkLabel" id="Plot Title Frame Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes"><b>Plot Title</b></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkFrame" id="Subtitle">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <property name="label_xalign">0</property>- <property name="shadow_type">in</property>- <child>- <object class="GtkHBox" id="Subtitle Input Widget">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <property name="spacing">2</property>- <child>- <object class="GtkEntry" id="Subtitle Entry">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="truncate_multiline">True</property>- <property name="invisible_char_set">True</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkSpinButton" id="Subtitle Size">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">0.5</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">Subtitle Font Size</property>- <property name="digits">1</property>- <property name="snap_to_ticks">True</property>- <property name="numeric">True</property>- <property name="update_policy">if-valid</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- </child>- <child type="label">- <object class="GtkLabel" id="Sub-Title Frame Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes"><b>Subtitle</b></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- <child>- <object class="GtkFrame" id="Axes">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <property name="label_xalign">0</property>- <property name="shadow_type">in</property>- <child>- <object class="GtkHBox" id="Axes Box">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <child>- <object class="GtkCheckButton" id="X-Axis Check">- <property name="label" translatable="yes">Show X-Axis</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">False</property>- <property name="active">True</property>- <property name="draw_indicator">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkCheckButton" id="Y-Axis Check">- <property name="label" translatable="yes">Show Y-Axis</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">False</property>- <property name="active">True</property>- <property name="draw_indicator">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- </child>- <child type="label">- <object class="GtkLabel" id="Axes Frame Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes"><b>Axes</b></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">2</property>- </packing>- </child>- <child>- <object class="GtkFrame" id="X-Range">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <property name="label_xalign">0</property>- <property name="shadow_type">in</property>- <child>- <object class="GtkVBox" id="X-Range Box">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <child>- <object class="GtkCheckButton" id="X-Range Check">- <property name="label" translatable="yes">Auto-Determine X-Range</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">False</property>- <property name="draw_indicator">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkHBox" id="X-Range Entries">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="spacing">2</property>- <property name="homogeneous">True</property>- <child>- <object class="GtkSpinButton" id="X-Range Lower Entry">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">0.25</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">X-Lower</property>- <property name="digits">2</property>- <property name="numeric">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkSpinButton" id="X-Range Upper Entry">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">0.25</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">X-Upper</property>- <property name="digits">2</property>- <property name="numeric">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- </child>- <child type="label">- <object class="GtkLabel" id="X-Range Frame Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes"><b>X-Range</b></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">3</property>- </packing>- </child>- <child>- <object class="GtkFrame" id="Y-Range">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <property name="label_xalign">0</property>- <property name="shadow_type">in</property>- <child>- <object class="GtkVBox" id="Y-Range Box">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">2</property>- <child>- <object class="GtkCheckButton" id="Y-Range Check">- <property name="label" translatable="yes">Auto-Determine Y-Range</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">False</property>- <property name="draw_indicator">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkHBox" id="Y-Range Entries">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="spacing">2</property>- <property name="homogeneous">True</property>- <child>- <object class="GtkSpinButton" id="Y-Range Lower Entry">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">0.25</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">Y-Lower</property>- <property name="digits">2</property>- <property name="numeric">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkSpinButton" id="Y-Range Upper Entry">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">0.25</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">Y-Upper</property>- <property name="digits">2</property>- <property name="numeric">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- </child>- <child type="label">- <object class="GtkLabel" id="Y-Range Frame Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes"><b>Y-Range</b></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">4</property>- </packing>- </child>- <child>- <object class="GtkFrame" id="Sampling Rate">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <property name="label_xalign">0</property>- <property name="shadow_type">in</property>- <child>- <object class="GtkVBox" id="Sampling Rate Box">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <child>- <object class="GtkSpinButton" id="Sampling Rate Entry">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">1</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">Sampling Adj</property>- <property name="digits">1</property>- <property name="snap_to_ticks">True</property>- <property name="numeric">True</property>- <property name="update_policy">if-valid</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- </object>- </child>- <child type="label">- <object class="GtkLabel" id="Sampling Frame Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes"><b>Sampling Rate</b></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">5</property>- </packing>- </child>- <child>- <object class="GtkFrame" id="Labels">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <property name="label_xalign">0</property>- <property name="shadow_type">in</property>- <child>- <object class="GtkVBox" id="Labels Box">- <property name="visible">True</property>- <property name="can_focus">False</property>- <child>- <object class="GtkVBox" id="X-Axis Label Widget">- <property name="visible">True</property>- <property name="can_focus">False</property>- <child>- <object class="GtkHBox" id="X-Label Input Widget">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">2</property>- <property name="spacing">2</property>- <child>- <object class="GtkEntry" id="X-Label Entry">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="invisible_char_set">True</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkSpinButton" id="X-Label Font Input">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">0.5</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">X-Label Size</property>- <property name="digits">1</property>- <property name="snap_to_ticks">True</property>- <property name="numeric">True</property>- <property name="update_policy">if-valid</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">-1</property>- </packing>- </child>- <child>- <object class="GtkLabel" id="X-Axis Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes">X-Axis Label</property>- <property name="use_markup">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkVBox" id="Y-Axis Label Widget">- <property name="visible">True</property>- <property name="can_focus">False</property>- <child>- <object class="GtkHBox" id="Y-Axis Input Widget">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">2</property>- <property name="spacing">2</property>- <child>- <object class="GtkEntry" id="Y-Label Entry">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="invisible_char_set">True</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkSpinButton" id="Y-Label Font Input">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">0.5</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">Y-Label Size</property>- <property name="digits">1</property>- <property name="snap_to_ticks">True</property>- <property name="numeric">True</property>- <property name="update_policy">if-valid</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">-1</property>- </packing>- </child>- <child>- <object class="GtkLabel" id="Y-Axis Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes">Y-Axis Label</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- </child>- <child type="label">- <object class="GtkLabel" id="Labels Frame Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes"><b>Labels</b></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">6</property>- </packing>- </child>- <child>- <object class="GtkFrame" id="Export">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">3</property>- <property name="label_xalign">0</property>- <property name="shadow_type">in</property>- <child>- <object class="GtkVBox" id="Export Box">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">1</property>- <child>- <object class="GtkVBox" id="Dimensions">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">2</property>- <child>- <object class="GtkLabel" id="Dimensions Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes">Dimensions</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkHBox" id="Dimension Entries">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="spacing">2</property>- <property name="homogeneous">True</property>- <child>- <object class="GtkSpinButton" id="Dimensions Width">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">0.25</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">Export Width</property>- <property name="numeric">True</property>- <property name="update_policy">if-valid</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkSpinButton" id="Dimensions Height">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="invisible_char">●</property>- <property name="progress_pulse_step">0.25</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- <property name="adjustment">Export Height</property>- <property name="numeric">True</property>- <property name="update_policy">if-valid</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkVBox" id="File Name & Type">- <property name="visible">True</property>- <property name="can_focus">False</property>- <child>- <object class="GtkLabel" id="File Name Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes">File Name & Type</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <object class="GtkHBox" id="File Name">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="border_width">1</property>- <property name="spacing">2</property>- <child>- <object class="GtkEntry" id="File Entry">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="tooltip_text" translatable="yes">File Name</property>- <property name="invisible_char">●</property>- <property name="invisible_char_set">True</property>- <property name="primary_icon_activatable">False</property>- <property name="secondary_icon_activatable">False</property>- <property name="primary_icon_sensitive">True</property>- <property name="secondary_icon_sensitive">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">0</property>- </packing>- </child>- <child>- <placeholder/>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">1</property>- </packing>- </child>- <child>- <object class="GtkButton" id="Export Button">- <property name="label" translatable="yes">Export</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="receives_default">True</property>- </object>- <packing>- <property name="expand">True</property>- <property name="fill">True</property>- <property name="position">2</property>- </packing>- </child>- </object>- </child>- <child type="label">- <object class="GtkLabel" id="Export Frame Label">- <property name="visible">True</property>- <property name="can_focus">False</property>- <property name="label" translatable="yes"><b>Export</b></property>- <property name="use_markup">True</property>- </object>- </child>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">7</property>- </packing>- </child>- </object>- </child>- </object>- </child>- </object>- <packing>- <property name="expand">False</property>- <property name="fill">True</property>- <property name="position">2</property>- </packing>- </child>- </object>- </child>- </object>- <object class="GtkAdjustment" id="Sampling Adj">- <property name="lower">1</property>- <property name="upper">1000</property>- <property name="value">1</property>- <property name="step_increment">1</property>- <property name="page_increment">1</property>- </object>- <object class="GtkAdjustment" id="Subtitle Font Size">- <property name="lower">1</property>- <property name="upper">72</property>- <property name="value">1</property>- <property name="step_increment">0.5</property>- <property name="page_increment">1</property>- </object>- <object class="GtkAdjustment" id="Title Font Size">- <property name="lower">1</property>- <property name="upper">72</property>- <property name="value">1</property>- <property name="step_increment">0.5</property>- <property name="page_increment">1</property>- </object>- <object class="GtkAdjustment" id="X-Label Size">- <property name="lower">1</property>- <property name="upper">72</property>- <property name="value">1</property>- <property name="step_increment">0.5</property>- <property name="page_increment">1</property>- </object>- <object class="GtkAdjustment" id="X-Lower">- <property name="lower">-1.7976931348623157e+308</property>- <property name="upper">1.7976931348623157e+308</property>- <property name="step_increment">0.01</property>- <property name="page_increment">1</property>- </object>- <object class="GtkAdjustment" id="X-Upper">- <property name="lower">-1.7976931348623157e+308</property>- <property name="upper">1.7976931348623157e+308</property>- <property name="step_increment">0.01</property>- <property name="page_increment">1</property>- </object>- <object class="GtkAdjustment" id="Y-Label Size">- <property name="lower">1</property>- <property name="upper">72</property>- <property name="value">1</property>- <property name="step_increment">0.5</property>- <property name="page_increment">1</property>- </object>- <object class="GtkAdjustment" id="Y-Lower">- <property name="lower">-1.7976931348623157e+308</property>- <property name="upper">1.7976931348623157e+308</property>- <property name="step_increment">0.01</property>- <property name="page_increment">1</property>- </object>- <object class="GtkAdjustment" id="Y-Upper">- <property name="lower">-1.7976931348623157e+308</property>- <property name="upper">1.7976931348623157e+308</property>- <property name="step_increment">0.01</property>- <property name="page_increment">1</property>- </object>-</interface>
+ src/Main.hs view
@@ -0,0 +1,9 @@+module Main where++import qualified PlotLab.Main+import Paths_plot_lab (getDataFileName)++main = do+ mainGlade <- getDataFileName "main-window.glade"+ plotGlade <- getDataFileName "plot-window.glade"+ PlotLab.Main.main mainGlade plotGlade
+ src/PlotLab/Events.hs view
@@ -0,0 +1,195 @@+module PlotLab.Events (attachHandlers) where++import PlotLab.FigureSettings++import Data.Maybe (fromJust)+import Data.Colour.Names+import Graphics.Rendering.Plot+import Graphics.UI.Gtk hiding(Circle,Cross)+import Data.Text (pack, unpack)+import Numeric.LinearAlgebra (linspace)+import Data.IORef (IORef, newIORef, readIORef, modifyIORef)+import Data.Char (toLower)++attachHandlers builder iofset adjs updateCanvas g buildFigure combo = do+ -- Canvas+ canvas <- builderGetObject builder castToDrawingArea "Plotting Canvas"+ let redraw = updateCanvas canvas iofset adjs+ onExpose canvas $ \_ -> redraw >> return False++ -- Adjustments for parameter sliders+ mapM_ (\x -> onValueChanged x redraw) adjs++ -- Plot-Title Entry+ titleEntry <- builderGetObject builder castToEntry "Plot Title Entry"+ onEntryActivate titleEntry $ do+ titleNew <- entryGetText titleEntry+ modifyIORef iofset $ \f -> f { plotTitle = Just titleNew }+ redraw++ -- Plot-Title Font Size+ titleSize <- builderGetObject builder castToAdjustment "Title Font Size"+ onValueChanged titleSize $ do+ size <- adjustmentGetValue titleSize+ modifyIORef iofset $ \f -> f { plotTitleSize = size }+ redraw++ -- Subtitle Entry+ subEntry <- builderGetObject builder castToEntry "Subtitle Entry"+ onEntryActivate subEntry $ do+ titleNew <- entryGetText subEntry+ modifyIORef iofset $ \f -> f { subTitle = Just titleNew }+ redraw++ -- Subtitle Font Size+ subSize <- builderGetObject builder castToAdjustment "Subtitle Font Size"+ onValueChanged subSize $ do+ size <- adjustmentGetValue subSize+ modifyIORef iofset $ \f -> f { subTitleSize = size }+ redraw++ -- Show X-Axis CheckButton+ showX <- builderGetObject builder castToCheckButton "X-Axis Check"+ onToggled showX $ do+ state <- toggleButtonGetActive showX+ fset <- readIORef iofset+ modifyIORef iofset+ (\f -> f { showXAxis = if state then True else False })+ redraw++ -- Show Y-Axis CheckButton+ showY <- builderGetObject builder castToCheckButton "Y-Axis Check"+ onToggled showY $ do+ state <- toggleButtonGetActive showY+ fset <- readIORef iofset+ modifyIORef iofset+ (\f -> f { showYAxis = if state then True else False })+ redraw++ -- X-Axis Range+ xLower <- builderGetObject builder castToAdjustment "X-Lower"+ xUpper <- builderGetObject builder castToAdjustment "X-Upper"+ let updateX x = onValueChanged x $ do+ xl <- adjustmentGetValue xLower+ xu <- adjustmentGetValue xUpper+ modifyIORef iofset $ \f -> f { xRange = Just (xl, xu) }+ redraw+ in mapM_ updateX [xLower, xUpper]++ -- X-Range Auto-determination CheckBox+ rangeEntries <- builderGetObject builder castToHBox "X-Range Entries"+ autoXCheck <- builderGetObject builder castToCheckButton "X-Range Check"+ onToggled autoXCheck $ do+ state <- toggleButtonGetActive autoXCheck+ if state+ then error "Invalid xRange"+ -- do modifyIORef iofset $ \f -> f { xRange = Nothing }+ -- widgetHideAll rangeEntries+ else do lower <- builderGetObject builder castToAdjustment "X-Lower"+ upper <- builderGetObject builder castToAdjustment "X-Upper"+ l <- adjustmentGetValue lower+ u <- adjustmentGetValue upper+ widgetShowAll rangeEntries+ modifyIORef iofset $ \f -> f { xRange = Just (l, u) }+ redraw++ -- Y-Axis Range+ yLower <- builderGetObject builder castToAdjustment "Y-Lower"+ yUpper <- builderGetObject builder castToAdjustment "Y-Upper"+ let updateY y = onValueChanged y $ do+ yl <- adjustmentGetValue yLower+ yu <- adjustmentGetValue yUpper+ modifyIORef iofset $ \f -> f { yRange = Just (yl, yu) }+ redraw+ in mapM_ updateY [yLower, yUpper]++ -- Y-Range Auto-determination CheckBox+ rangeEntries <- builderGetObject builder castToHBox "Y-Range Entries"+ autoYCheck <- builderGetObject builder castToCheckButton "Y-Range Check"+ onToggled autoYCheck $ do+ state <- toggleButtonGetActive autoYCheck+ if state+ then do modifyIORef iofset $ \f -> f { yRange = Nothing }+ widgetHideAll rangeEntries+ else do lower <- builderGetObject builder castToAdjustment "Y-Lower"+ upper <- builderGetObject builder castToAdjustment "Y-Upper"+ l <- adjustmentGetValue lower+ u <- adjustmentGetValue upper+ widgetShowAll rangeEntries+ modifyIORef iofset $ \f -> f { yRange = Just (l, u) }+ redraw++ -- Sampling Rate+ sampleRate <- builderGetObject builder castToAdjustment "Sampling Adj"+ onValueChanged sampleRate $ do+ rate <- adjustmentGetValue sampleRate+ modifyIORef iofset $ \f -> f { samplingRate = floor rate }+ redraw++ -- X-Label Entry+ xLabelEntry <- builderGetObject builder castToEntry "X-Label Entry"+ onEntryActivate xLabelEntry $ do+ labelNew <- entryGetText xLabelEntry+ modifyIORef iofset $ \f -> f { xLabel = Just labelNew }+ redraw++ -- X-Label Size+ xlSize <- builderGetObject builder castToAdjustment "X-Label Size"+ onValueChanged xlSize $ do+ size <- adjustmentGetValue xlSize+ modifyIORef iofset $ \f -> f { xLabelSize = size }+ redraw++ -- Y-Label Entry+ yLabelEntry <- builderGetObject builder castToEntry "Y-Label Entry"+ onEntryActivate yLabelEntry $ do+ labelNew <- entryGetText yLabelEntry+ modifyIORef iofset $ \f -> f { yLabel = Just labelNew }+ redraw++ ylSize <- builderGetObject builder castToAdjustment "Y-Label Size"+ onValueChanged ylSize $ do+ size <- adjustmentGetValue ylSize+ modifyIORef iofset $ \f -> f { yLabelSize = size }+ redraw++ -- Export Filename extry++ -- Export Button+ export <- builderGetObject builder castToButton "Export Button"+ onClicked export $ do+ fset <- readIORef iofset+ vars <- mapM adjustmentGetValue adjs++ comboText <- comboBoxGetActiveText combo+ nameEntry <- builderGetObject builder castToEntry "File Entry"+ nameText <- entryGetText nameEntry++ modifyIORef iofset $ \f -> f { fileName = nameText }++ let rate = samplingRate fset+ samples = (\(x, y) -> rate * floor (y - x)) (fromJust $ xRange fset)+ domain = linspace samples (fromJust $ xRange fset)+ f = g vars+ dset = (domain, [line f blue])+ dimensions = exportSize fset++ parseType txt = case txt of+ "PNG" -> PNG+ "SVG" -> SVG+ "PS" -> PS+ "PDF" -> PDF++ filetype = let ftype = if comboText == Nothing+ then error "Invalid FileType!"+ else unpack $ fromJust comboText+ in parseType ftype++ parseExt fileType = case fileType of+ PNG -> "PNG"+ SVG -> "SVG"+ PS -> "PS"+ PDF -> "PDF"++ filename = nameText ++ "." ++ (map toLower $ parseExt filetype)+ writeFigure filetype filename dimensions $ buildFigure dset fset
+ src/PlotLab/FigureSettings.hs view
@@ -0,0 +1,50 @@+module PlotLab.FigureSettings (FigureSettings(..), defaultSettings) where++import Graphics.Rendering.Plot++data FigureSettings =+ FigureSettings+ { fontFamily :: String+ , plotTitle :: Maybe String+ , plotTitleSize :: Double+ , subTitle :: Maybe String+ , subTitleSize :: Double+ , xRange :: Maybe (Double, Double)+ , yRange :: Maybe (Double, Double)+ , samplingRate :: Int+ , xLabel :: Maybe String+ , xLabelSize :: Double+ , yLabel :: Maybe String+ , yLabelSize :: Double+ , showXAxis :: Bool+ , xLocation :: (AxisPosn, AxisSide)+ , showYAxis :: Bool+ , yLocation :: (AxisPosn, AxisSide)+ , plotScaleX :: Graphics.Rendering.Plot.Scale+ , plotScaleY :: Graphics.Rendering.Plot.Scale+ , exportSize :: (Int, Int)+ , fileName :: String+ }++defaultSettings = FigureSettings+ { fontFamily = "Sans"+ , plotTitle = Nothing+ , plotTitleSize = 10+ , subTitle = Nothing+ , subTitleSize = 10+ , xRange = Nothing+ , yRange = Nothing+ , samplingRate = 10+ , xLabel = Nothing+ , xLabelSize = 10+ , yLabel = Nothing+ , yLabelSize = 10+ , showXAxis = True+ , xLocation = (Side Lower, Lower)+ , showYAxis = True+ , yLocation = (Side Lower, Lower)+ , plotScaleX = Linear+ , plotScaleY = Linear+ , exportSize = (1000, 1000)+ , fileName = "plot"+ }
+ src/PlotLab/Main.hs view
@@ -0,0 +1,275 @@+module PlotLab.Main (main) where++import Control.Monad (when)+import Data.Maybe (fromJust)+import Data.Colour.Names+import Graphics.Rendering.Plot+import Graphics.UI.Gtk hiding(Circle,Cross)+import Data.IORef (IORef, newIORef, readIORef, modifyIORef)+import Numeric.LinearAlgebra (linspace)+import Data.Text (pack, unpack)++import PlotLab.Events (attachHandlers)+import PlotLab.FigureSettings++-- import Control.Concurrent+-- import Control.Concurrent.MVar+-- import qualified Graphics.Rendering.Pango as P+-- import qualified Graphics.Rendering.Cairo as C+-- import Data.Packed.Vector+-- import Data.Packed.Random+-- import Data.Packed()+-- import Numeric.LinearAlgebra.Instances+-- import Numeric.LinearAlgebra.Interface+-- import Numeric.GSL.Statistics+-- import Debug.Trace+-- import qualified Data.Array.IArray as A++--------------------------------------------------------------------------------++updateFigureText :: (Text () -> Figure ())+ -> (Maybe String) -> Double -> Figure ()+updateFigureText withSomething txt size =+ withSomething $ do if txt == Nothing+ then setText ""+ else setText (fromJust txt)+ setFontSize size++--------------------------------------------------------------------------------++updateAxis axis show location range scale label size = do+ let (position, side) = location++ when show $ addAxis axis position+ (when (label /= Nothing) $ withAxisLabel $ do setText $ fromJust label+ setFontSize size)+ if range == Nothing+ then setRangeFromData axis side scale+ else uncurry (setRange axis side scale) (fromJust range)++--------------------------------------------------------------------------------++buildFigure :: (Dataset a) => a -> FigureSettings -> Figure ()+buildFigure dset fset = do+ withTextDefaults $ setFontFamily (fontFamily fset)++ let title = plotTitle fset+ size = plotTitleSize fset+ in updateFigureText withTitle title size++ let title = subTitle fset+ size = subTitleSize fset+ in updateFigureText withSubTitle title size++ setPlots 1 1+ withPlot (1, 1) $ do+ setDataset dset++ -- X-Axis+ let show = showXAxis fset+ text = xLabel fset+ size = xLabelSize fset+ loc = xLocation fset+ range = xRange fset+ scale = plotScaleX fset+ in updateAxis XAxis show loc range scale text size++ -- Y-Axis+ let show = showYAxis fset+ text = yLabel fset+ size = yLabelSize fset+ loc = yLocation fset+ range = yRange fset+ scale = plotScaleY fset+ in updateAxis YAxis show loc range scale text size++--------------------------------------------------------------------------------++type AdjustmentSettings = (Double, Double, Double, Double, Double, Double)++--------------------------------------------------------------------------------++addSlidersToBox :: [AdjustmentSettings] -> VBox -> IO [Adjustment]+addSlidersToBox conf box = do+ let newAdj (a, b, c, d, e, f) = adjustmentNew a b c d e f+ newAdjList conf = mapM newAdj conf+ newHScaleList adjs = mapM hScaleNew adjs++ adjs <- newAdjList conf+ sliders <- newHScaleList adjs+ mapM_ (\x -> scaleSetValuePos x PosRight) sliders+ mapM_ (\x -> scaleSetDigits x 2) sliders+ mapM_ (\x -> boxPackEnd box x PackNatural 0) sliders+ return adjs++--------------------------------------------------------------------------------++updateCanvas :: DrawingArea -> IORef FigureSettings -> [Adjustment] -> IO ()+updateCanvas canvas iofset adjs = do+ fset <- readIORef iofset+ s@(w, h) <- widgetGetSize canvas+ drw <- widgetGetDrawWindow canvas+ vars <- mapM adjustmentGetValue adjs++ let rate = samplingRate fset+ samples = (\(x, y) -> rate * floor (y - x)) (fromJust $ xRange fset)+ domain = linspace samples (fromJust $ xRange fset)+ f = g vars+ dset = (domain, [line f blue])+ r = render $ buildFigure dset fset++ region <- regionRectangle $ Rectangle 0 0 w h+ drawWindowBeginPaintRegion drw region+ renderWithDrawable drw (r s)+ drawWindowEndPaint drw++--------------------------------------------------------------------------------++-- Create a new window+-- Initially fill the values+-- Call PlotLab.Events.attachHandlers to attach Event Handlers+figureWindow :: String -> IORef FigureSettings -> [AdjustmentSettings]+ -> ([Double] -> Double -> Double) -> IO ()+figureWindow plotGlade iofset conf g = do+ builder <- builderNew+ builderAddFromFile builder plotGlade++ plotBox <- builderGetObject builder castToVBox "Plot Region"+ adjs <- addSlidersToBox conf plotBox+ fset <- readIORef iofset++ let updateEntryText entryGlade text =+ when (text /= Nothing) $ do entry <- builderGetObject builder+ castToEntry entryGlade+ entrySetText entry $ fromJust text+ in do updateEntryText "Plot Title Entry" $ plotTitle fset+ updateEntryText "Subtitle Entry" $ subTitle fset+ updateEntryText "X-Label Entry" $ xLabel fset+ updateEntryText "Y-Label Entry" $ yLabel fset+ updateEntryText "File Entry" $ Just (fileName fset)++ let adjApplyValue adjGlade val = do+ adj <- builderGetObject builder castToAdjustment adjGlade+ adjustmentSetValue adj val+ in do adjApplyValue "Title Font Size" $ plotTitleSize fset+ adjApplyValue "Subtitle Font Size" $ subTitleSize fset+ adjApplyValue "Sampling Adj" $ fromIntegral $ samplingRate fset+ adjApplyValue "X-Label Size" $ xLabelSize fset+ adjApplyValue "Y-Label Size" $ yLabelSize fset++ let checkApplyState checkGlade state = do+ check <- builderGetObject builder castToCheckButton checkGlade+ toggleButtonSetActive check $ if state then True else False+ in do checkApplyState "X-Axis Check" $ showXAxis fset+ checkApplyState "Y-Axis Check" $ showYAxis fset+ checkApplyState "Y-Range Check" $ yRange fset == Nothing++ -- Y-Axis Range and CheckButton+ let range = yRange fset+ in if range == Nothing+ then do entries <- builderGetObject builder castToHBox "Y-Range Entries"+ widgetHideAll entries+ else let (l, u) = fromJust range+ in do lower <- builderGetObject builder castToAdjustment "Y-Lower"+ upper <- builderGetObject builder castToAdjustment "Y-Upper"+ adjustmentSetValue lower l+ adjustmentSetValue upper u+ -- X-Axis Range+ let range = xRange fset+ in if range == Nothing+ then error "Invalid xRange"+ else let (l, u) = fromJust range+ in do lower <- builderGetObject builder castToAdjustment "X-Lower"+ upper <- builderGetObject builder castToAdjustment "X-Upper"+ adjustmentSetValue lower l+ adjustmentSetValue upper u++ -- Export Size+ let (w, h) = exportSize fset+ in do width <- builderGetObject builder castToAdjustment "Export Width"+ height <- builderGetObject builder castToAdjustment "Export Height"+ adjustmentSetValue width $ fromIntegral w+ adjustmentSetValue height $ fromIntegral h++ -- Export ComboBox+ combo <- comboBoxNewText+ mapM (\(x, y) -> comboBoxInsertText combo x $ pack y)+ [(1, "PNG"), (2, "SVG"), (3, "PS"), (4, "PDF")]+ comboBoxSetActive combo 0++ comboArea <- builderGetObject builder castToHBox "File Name"+ boxPackEndDefaults comboArea combo++ -- Attach Event Handlers+ attachHandlers builder iofset adjs updateCanvas g buildFigure combo++ -- Show Widgets+ plotWindow <- builderGetObject builder castToWindow "Plot Window"+ widgetShowAll plotWindow++ -- Hide the useless checkButton for now+ check <- builderGetObject builder castToCheckButton "X-Range Check"+ widgetHide check++--------------------------------------------------------------------------------++giveSettings :: FigureSettings -> IO (IORef FigureSettings)+giveSettings fst = do+ ref <- newIORef fst++ modifyIORef ref $ \f ->+ f { plotTitle = Just "Example: Sum of two gaussian distributions"+ , subTitle = Just "Play with the sliders, and other options"+ , xRange = Just (-5, 5)+ , yRange = Just ( 0, 2)+ , plotTitleSize = 12.5+ }+ return ref++--------------------------------------------------------------------------------++mu1 = (-5.00, -5.00, 5.00, 0.01, 0.01, 0.00)+sigma1 = ( 1.00, 0.01, 6.00, 0.01, 0.01, 0.00)+mu2 = ( 0.00, -5.00, 5.00, 0.01, 0.01, 0.00)+sigma2 = ( 1.00, 0.01, 6.00, 0.01, 0.01, 0.00)++--------------------------------------------------------------------------------++-- Gaussian Distribution+h :: [Double] -> Double -> Double+h [s, m] x = exp (-((x - m) ** 2) / (2 * (s ** 2))) / (s * sqrt (2 * pi))++g :: [Double] -> Double -> Double+g [a, b, c, d] x = h [a, b] x + h [c, d] x++--------------------------------------------------------------------------------++main mainGlade plotGlade = do+ initGUI+ builder <- builderNew+ builderAddFromFile builder mainGlade+ mainWindow <- builderGetObject builder castToWindow "Main Window"+ plotButton <- builderGetObject builder castToButton "Plot Button"+ onDestroy mainWindow mainQuit+ widgetShowAll mainWindow+ settings <- giveSettings defaultSettings+ onClicked plotButton $+ figureWindow plotGlade settings [sigma2, mu2, sigma1, mu1] g+ mainGUI++--------------------------------------------------------------------------------++-- xs = linspace ln (-2.5, 2.5) :: Vector Double+-- ys = ln |> [exp (-x ** 2) | x <- [(-2.5),(-2.475)..2.5] :: [Double]]++-- figure = buildFigure (domain, [point (ys, xs) (Cross, red),+-- line f1 red, line f2 green,+-- line f3 blue, line f4 black]) default_fset++-- export = writeFigure SVG "plot.svg" (1000,1000) $ buildFigure dset fset++--------------------------------------------------------------------------------++-- applyParameters :: (Function a) => a -> [Double] -> (Double -> Double)++--------------------------------------------------------------------------------