/* printcompositor.cc
 *
 * Copyright (C) 2009, 2010, 2011 Krzesimir Nowak
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtksourceview/gtksourceprintcompositor.h>

namespace Gsv
{

PrintCompositor::PrintCompositor(const View& view) :
  _CONSTRUCT("buffer", Glib::unwrap(view.get_source_buffer()), "tab-width", view.get_tab_width(), "highlight-syntax", view.get_source_buffer()->get_highlight_syntax(), "wrap-mode", static_cast<GtkWrapMode>(view.get_wrap_mode()), "print-line-numbers", (view.get_show_line_numbers() ? 0 : 1))
{
  set_body_font_name(const_cast<View&>(view).get_pango_context()->get_font_description().to_string());
}

void
PrintCompositor::set_header_format(bool separator, const Glib::ustring& left, const Glib::ustring& center, const Glib::ustring& right)
{
  gtk_source_print_compositor_set_header_format(gobj(), static_cast<gboolean>(separator), (left.empty() ? 0 : left.c_str()), (center.empty() ? 0 : center.c_str()), (right.empty() ? 0 : right.c_str()));
}

void
PrintCompositor::set_footer_format(bool separator, const Glib::ustring& left, const Glib::ustring& center, const Glib::ustring& right)
{
  gtk_source_print_compositor_set_footer_format(gobj(), static_cast<gboolean>(separator), (left.empty() ? 0 : left.c_str()), (center.empty() ? 0 : center.c_str()), (right.empty() ? 0 : right.c_str()));
}

} // namespace Gsv
