@@ -5,7 +5,7 @@ Author: Ho-Jung Kim (godmode2k@hotmail.com)
5
5
Date: Since Dec 2, 2014
6
6
Filename: CViewMain.cpp
7
7
8
- Last modified: Feb 3 , 2015
8
+ Last modified: Feb 8 , 2015
9
9
License:
10
10
11
11
*
@@ -1499,6 +1499,11 @@ bool CViewMain::attach_add_text(const char* text, const char* bg_img_filename,
1499
1499
if ( !text )
1500
1500
__LOGT__ ( TAG, " attach_add_text(): Text == NULL" );
1501
1501
1502
+ if ( attach ) {
1503
+ delete attach;
1504
+ attach = NULL ;
1505
+ }
1506
+
1502
1507
return false ;
1503
1508
}
1504
1509
@@ -1565,12 +1570,26 @@ bool CViewMain::attach_add_text(const char* text, const char* bg_img_filename,
1565
1570
// Background Image
1566
1571
if ( !m_tmp_obj_bg_img_info.selected_bg_img ) {
1567
1572
if ( bg_img_filename ) {
1568
- attach->load_image ( bg_img_filename );
1573
+ if ( !attach->load_image (bg_img_filename) ) {
1574
+ if ( attach ) {
1575
+ delete attach;
1576
+ attach = NULL ;
1577
+ }
1578
+
1579
+ return false ;
1580
+ }
1569
1581
}
1570
1582
}
1571
1583
else {
1572
1584
if ( m_tmp_obj_bg_img_info.bg_img_filename ) {
1573
- attach->load_image ( m_tmp_obj_bg_img_info.bg_img_filename );
1585
+ if ( !attach->load_image (m_tmp_obj_bg_img_info.bg_img_filename ) ) {
1586
+ if ( attach ) {
1587
+ delete attach;
1588
+ attach = NULL ;
1589
+ }
1590
+
1591
+ return false ;
1592
+ }
1574
1593
}
1575
1594
}
1576
1595
@@ -1698,6 +1717,11 @@ bool CViewMain::attach_add_image(const char* img_filename, const char* tag) {
1698
1717
if ( !img_filename )
1699
1718
__LOGT__ ( TAG, " attach_add_image(): Image filename == NULL" );
1700
1719
1720
+ if ( attach ) {
1721
+ delete attach;
1722
+ attach = NULL ;
1723
+ }
1724
+
1701
1725
return false ;
1702
1726
}
1703
1727
@@ -1707,7 +1731,14 @@ bool CViewMain::attach_add_image(const char* img_filename, const char* tag) {
1707
1731
attach->set_obj_type ( type );
1708
1732
attach->set_tag2 ( tag );
1709
1733
attach->set_obj_rect ( 50 .f , 50 .f , 100 .f , 100 .f );
1710
- attach->load_image ( img_filename );
1734
+ if ( !attach->load_image (img_filename) ) {
1735
+ if ( attach ) {
1736
+ delete attach;
1737
+ attach = NULL ;
1738
+ }
1739
+
1740
+ return false ;
1741
+ }
1711
1742
1712
1743
m_pvec_attach->push_back ( attach );
1713
1744
}
@@ -1716,6 +1747,37 @@ bool CViewMain::attach_add_image(const char* img_filename, const char* tag) {
1716
1747
return true ;
1717
1748
}
1718
1749
1750
+ bool CViewMain::attach_rotate (void ) {
1751
+ // __LOGT__( TAG, "attach_rotate()" );
1752
+
1753
+ bool ret = false ;
1754
+
1755
+ if ( !m_pvec_attach ) {
1756
+ __LOGT__ ( TAG, " attach_rotate(): Attachment Container == NULL" );
1757
+ return false ;
1758
+ }
1759
+
1760
+ if ( m_pvec_attach->size () > 0 ) {
1761
+ std::vector<CViewAttach*>::iterator iter;
1762
+
1763
+ for ( iter = m_pvec_attach->begin (); iter != m_pvec_attach->end (); ++iter ) {
1764
+ CViewAttach* attach = (*iter);
1765
+
1766
+ if ( attach ) {
1767
+ if ( attach->get_selected () ) {
1768
+ attach->set_obj_rotate ( true );
1769
+ ret = true ;
1770
+
1771
+ break ;
1772
+ }
1773
+ }
1774
+ } // for()
1775
+ }
1776
+
1777
+
1778
+ return ret;
1779
+ }
1780
+
1719
1781
bool CViewMain::attach_delete (void ) {
1720
1782
// __LOGT__( TAG, "attach_delete()" );
1721
1783
@@ -1845,6 +1907,7 @@ bool CViewMain::attach_invalidate(CBaseView* view) {
1845
1907
if ( attach ) {
1846
1908
if ( take_screenshot_get_region () ) {
1847
1909
attach->set_select ( false );
1910
+ attach->set_obj_rotate ( false );
1848
1911
}
1849
1912
1850
1913
attach->invalidate ( view );
@@ -1880,6 +1943,7 @@ bool CViewMain::attach_touch_event(CKeyEvent* event) {
1880
1943
if ( attach ) {
1881
1944
if ( found ) {
1882
1945
attach->set_select ( false );
1946
+ attach->set_obj_rotate ( false );
1883
1947
continue ;
1884
1948
}
1885
1949
0 commit comments