/
articleviewpreview.cpp
109 lines (77 loc) · 2.21 KB
/
articleviewpreview.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// ライセンス: GPL2
//#define _DEBUG
#include "jddebug.h"
#include "articleadmin.h"
#include "articleviewpreview.h"
#include "drawareamain.h"
#include "message/messageadmin.h"
#include "dbtree/articlebase.h"
#include "jdlib/misctime.h"
#include "controlid.h"
#include <sys/time.h>
using namespace ARTICLE;
ArticleViewPreview::ArticleViewPreview( const std::string& url )
: ArticleViewBase( url )
{
struct timeval tv;
struct timezone tz;
gettimeofday( &tv, &tz );
set_url( url_article() + MISC::timevaltostr( tv ) + ARTICLE_SIGN + "_PREV_" );
#ifdef _DEBUG
std::cout << "ArticleViewPreview::ArticleViewPreview " << get_url() << std::endl;
#endif
setup_view();
// コントロールモード設定
get_control().set_mode( CONTROL::MODE_MESSAGE );
}
ArticleViewPreview::~ArticleViewPreview()
{
#ifdef _DEBUG
std::cout << "ArticleViewPreview::~ArticleViewPreview : " << get_url() << std::endl;
#endif
}
//
// ウィジットのパッキング
//
// ArticleViewBase::pack_widget()をオーパロードしてツールバーをパックしない
//
void ArticleViewPreview::pack_widget()
{
pack_start( *drawarea() );
}
//
// viewの操作
//
void ArticleViewPreview::operate_view( const int& control )
{
switch( control ){
// 閉じる
case CONTROL::Quit:
case CONTROL::CancelWrite:
MESSAGE::get_admin()->set_command( "close_currentview" );
break;
// 書き込み実行
case CONTROL::ExecWrite:
MESSAGE::get_admin()->set_command( "exec_Write" );
break;
case CONTROL::TabLeft:
MESSAGE::get_admin()->set_command( "tab_left" );
break;
case CONTROL::TabRight:
MESSAGE::get_admin()->set_command( "tab_right" );
break;
default:
ArticleViewBase::operate_view( control );
break;
}
}
//
// dat をappend
//
// ArticleViewBase::append_dat()をオーパロードしてappendする前に表示を消す
//
void ArticleViewPreview::append_dat( const std::string& dat, int num )
{
drawarea()->clear_screen();
ArticleViewBase::append_dat( dat, get_article()->get_number_load() +1 );
}