Commit e053a3ea authored by Florent D'Halluin's avatar Florent D'Halluin
Browse files

[yavgui] Fix compilation.

* yavgui/src/Makefile.am: Small fixes.
* yavgui/src/command_macros.hh,
* yavgui/src/common.hh,
* yavgui/src/g_painter.hxx,
* yavgui/src/g_state.cc,
* yavgui/src/g_transition.cc,
* yavgui/src/main.cc: Small fixes, use CBS.
* yavgui/src/loaders.hxx,
* yavgui/src/savers.hh: Disable RW input/output (not working).
parent b741c498
2009-08-04 d-halluin <d-halluin@lrde.epita.fr>
[yavgui] Fix compilation.
* yavgui/src/Makefile.am: Small fixes.
* yavgui/src/command_macros.hh,
* yavgui/src/common.hh,
* yavgui/src/g_painter.hxx,
* yavgui/src/g_state.cc,
* yavgui/src/g_transition.cc,
* yavgui/src/main.cc: Small fixes, use CBS.
* yavgui/src/loaders.hxx,
* yavgui/src/savers.hh: Disable RW input/output (not working).
2009-07-15 d-halluin <d-halluin@lrde.epita.fr>
 
Update cbs.
......
......@@ -15,7 +15,7 @@ include $(top_srcdir)/vaucanson.mk
include $(top_srcdir)/build-aux/autotroll.mk
AM_CPPFLAGS += $(CXXFLAGS_OPTIMIZE)
AM_LDFLAGS = $(TERMLIBS)
AM_LDFLAGS += $(TERMLIBS)
bin_PROGRAMS = yavgui
......@@ -46,15 +46,6 @@ COMMON_SOURCES = main.cc \
yavgui.cc
## ------ ##
## argp. ##
## ------ ##
# Be sure to fetch the argp we ship.
AM_CPPFLAGS += -I$(top_srcdir)/argp
LDADD = $(top_builddir)/argp/libargp.la
## -------- ##
## yavgui. ##
## -------- ##
......@@ -69,7 +60,8 @@ yavgui_LDFLAGS = $(AM_LDFLAGS) $(QT_LDFLAGS) \
-lvcsn-z-fmp-tdc \
-lvcsn-fmp-tdc \
-lvcsn-tdc \
-lvcsn-r
-lvcsn-r \
-lvcsn-common-ex
yavgui_LDADD = $(QT_LIBS) $(LDADD)
BUILT_SOURCES =
......@@ -59,23 +59,23 @@
# include "common.hh"
// Each new command is a class.
# define COMMAND_BASE(Name, Flags, Code) \
class Name : public VcsnCommand \
{ \
public: \
Name () \
: VcsnCommand () \
{ \
Flags \
} \
\
Code \
\
void execute_(AutomatonInstance& automaton_instance) \
{ \
boost::apply_visitor(*this, \
automaton_instance.vcsn_automaton ().automaton ()); \
} \
# define COMMAND_BASE(Name, Flags, Code) \
class Name : public VcsnCommand \
{ \
public: \
Name () \
: VcsnCommand () \
{ \
Flags \
} \
\
Code \
\
void execute_(AutomatonInstance& automaton_instance) \
{ \
boost::apply_visitor(*this, \
automaton_instance.vcsn_automaton ().automaton ()); \
} \
}
// Flags
......
......@@ -43,10 +43,6 @@
#include <vaucanson/config/system.hh>
// Use a global timer and bencher.
# define GLOBAL_TIMER global_timer
# include <vaucanson/misc/global_timer.hh>
extern vcsn::misc::Timer global_timer;
#include <cbs/bench/bench_macros.hh>
#endif /* !COMMON_HH_ */
......@@ -29,6 +29,7 @@
# include "common.hh"
# include <cmath>
# include <sstream>
# include <vaucanson/misc/usual_macros.hh>
......
......@@ -59,7 +59,7 @@ namespace yavgui
QRectF
GState::boundingRect () const
{
TIMER_SCOPED("GState::boundingRect ()");
BENCH_TASK_SCOPED("GState::boundingRect ()");
return QRectF (-radius_, -radius_,
2 * radius_, 2 * radius_);
}
......@@ -67,7 +67,7 @@ namespace yavgui
QPainterPath
GState::shape () const
{
TIMER_SCOPED("GState::shape ()");
BENCH_TASK_SCOPED("GState::shape ()");
QPainterPath path;
path.addEllipse (boundingRect ());
return path;
......@@ -78,25 +78,47 @@ namespace yavgui
const QStyleOptionGraphicsItem *,
QWidget *)
{
TIMER_SCOPED("GState::paint ()");
BENCH_TASK_SCOPED("GState::paint ()");
painter->setPen (QColor ("black"));
painter->setBrush (color_);
painter->drawEllipse (boundingRect ());
if (final_)
if (!final_entry_.isNull())
{
painter->setPen (QColor ("black"));
QRectF rec (-radius_ + 5, -radius_ + 5,
2 * radius_ - 10, 2 * radius_ - 10);
painter->drawEllipse (rec);
painter->setPen ("black");
QPainterPath path;
path.moveTo (radius_, 0);
path.lineTo (radius_ + 40, 0);
painter->drawPath (path);
{
QPainterPath path;
QPointF c2 (radius_ + 32, - 4);
QPointF c3 (radius_ + 32, + 4);
path.moveTo (radius_ + 40, 0);
path.lineTo (c2);
path.lineTo (c3);
path.lineTo (radius_ + 40, 0);
painter->setBrush (color_);
painter->drawPath (path);
}
painter->drawText (QRect(radius_ + 40, -radius_, 40, radius_),
Qt::AlignCenter
| Qt::AlignTop,
final_entry_);
}
painter->drawText (boundingRect (), Qt::AlignCenter
| Qt::AlignVCenter,
label_);
if (initial_)
if (!initial_entry_.isNull())
{
painter->setPen ("black");
......
......@@ -75,7 +75,7 @@ namespace yavgui
QRectF
GTransition::boundingRect () const
{
TIMER_SCOPED("GTransition::boundingRect ()");
BENCH_TASK_SCOPED("GTransition::boundingRect ()");
return bounding_rect_;
}
......@@ -83,7 +83,7 @@ namespace yavgui
QPainterPath
GTransition::shape () const
{
TIMER_SCOPED("GTransition::shape ()");
BENCH_TASK_SCOPED("GTransition::shape ()");
return shape_;
}
......@@ -93,7 +93,7 @@ namespace yavgui
const QStyleOptionGraphicsItem *,
QWidget *)
{
TIMER_SCOPED("GTransition::paint ()");
BENCH_TASK_SCOPED("GTransition::paint ()");
painter->setPen (color_);
painter->drawPath (curve_);
......@@ -119,7 +119,7 @@ namespace yavgui
void
GTransition::refresh ()
{
TIMER_SCOPED("GTransition::refresh ()");
BENCH_TASK_SCOPED("GTransition::refresh ()");
{
// Hooks
......
......@@ -27,6 +27,7 @@
# include "exceptions.hh"
# include <vaucanson/xml/contexts/fmp.hh>
# include <vaucanson/xml/XML.hh>
# include <vaucanson/tools/fsm_load.hh>
# include <vaucanson/tools/io.hh>
......@@ -122,12 +123,12 @@ namespace yavgui
FMP
)
USUAL_LOADER(boolean_transducer::automaton_t,
boolean_transducer::make_automaton
(boolean_transducer::alphabet_t (),
boolean_transducer::alphabet_t ());,
RW
)
// USUAL_LOADER(boolean_transducer::automaton_t,
// boolean_transducer::make_automaton
// (boolean_transducer::alphabet_t (),
// boolean_transducer::alphabet_t ());,
// RW
// )
Loader::Loader ()
{
......@@ -135,8 +136,8 @@ namespace yavgui
(new ConcreteAutomatonLoader<z_automaton::automaton_t> ());
loaders_.push_back
(new ConcreteAutomatonLoader<boolean_automaton::automaton_t> ());
loaders_.push_back
(new ConcreteAutomatonLoader<boolean_transducer::automaton_t> ());
// loaders_.push_back
// (new ConcreteAutomatonLoader<boolean_transducer::automaton_t> ());
loaders_.push_back
(new ConcreteAutomatonLoader<fmp_transducer::automaton_t> ());
}
......
......@@ -24,9 +24,6 @@
using namespace yavgui;
/// A global timer.
vcsn::misc::Timer global_timer;
int main(int argc, char** argv)
{
Yavgui* yavgui = Yavgui::Instance (&argc, argv);
......@@ -34,20 +31,17 @@ int main(int argc, char** argv)
if (!yavgui)
return 0;
TIMER_START();
BENCH_START("Yavgui process", "");
int result = yavgui->application ()->exec ();
TIMER_STOP();
std::ofstream out_dot ("timer.dot");
std::ofstream out_log ("timer.log");
TIMER_PRINT(out_log);
TIMER_EXPORT_DOT_VD(out_dot, vcsn::misc::timer::VERBOSE_MINIMAL);
BENCH_STOP();
out_dot.close ();
out_log.close ();
BENCH_SAVE("yavgui_bench.xml", bench::Options());
BENCH_SAVE("yavgui_bench.out", bench::Options(bench::Options::VE_MINIMAL,
bench::Options::FO_TEXT));
BENCH_SAVE("yavgui_bench.dot", bench::Options(bench::Options::VE_NORMAL,
bench::Options::FO_DOT));
return result;
}
......@@ -27,6 +27,9 @@
# include <QString>
# include <vaucanson/xml/contexts/fmp.hh>
# include <vaucanson/xml/XML.hh>
# include "common.hh"
# include "vcsn_automaton_variant.hh"
......@@ -36,7 +39,7 @@ void operator() (Automaton& automaton) \
if (!out) \
throw exceptions::CantSaveAutomaton (); \
*out << automaton_saver (automaton, tools::string_out (), \
xml::XML ()); \
xml::XML ()); \
\
}
......@@ -67,7 +70,7 @@ namespace yavgui
USUAL_SAVER(boolean_automaton::automaton_t)
USUAL_SAVER(z_automaton::automaton_t)
USUAL_SAVER(fmp_transducer::automaton_t)
USUAL_SAVER(boolean_transducer::automaton_t)
//USUAL_SAVER(boolean_transducer::automaton_t)
template <typename Automaton>
void operator() (Automaton&)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment